Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initdb permission denied when running sourcegraph/server:2.4.3 on docker-machine on macOS #41

Closed
sqs opened this issue Feb 4, 2018 · 5 comments

Comments

@sqs
Copy link
Member

@sqs sqs commented Feb 4, 2018

  • Issue type: bug report
  • Sourcegraph version: 2.4.3
  • OS Version: macOS
  • Docker version: 17.09.0-ce
 docker run \
--publish 7080:7080 --rm \
--volume $HOME/.sourcegraph/config:/etc/sourcegraph \
--volume $HOME/.sourcegraph/data:/var/opt/sourcegraph \
sourcegraph/server:2.4.3

Fails with:

initdb: could not create directory "/var/opt/sourcegraph/postgresql/pg_xlog": Permission denied

This is on:

Very basic docker setup using docker-machine on osx

Note that this is not Docker for Mac, it is docker-machine (using VirtualBox).

@sqs sqs added the bug label Feb 4, 2018
@sqs sqs changed the title initdb permission denied when running sourcegraph/server:2.4.3 on macOS initdb permission denied when running sourcegraph/server:2.4.3 on docker-machine on macOS Feb 4, 2018
@sqs
Copy link
Member Author

@sqs sqs commented Feb 4, 2018

The workaround for running Sourcegraph on macOS under docker-machine (not Docker for Mac) is:

  1. Run the command with different --volume paths (that are not in $HOME):
docker run \
--publish 7080:7080 --rm \
--volume /tmp/sourcegraph/config:/etc/sourcegraph \
--volume /tmp/sourcegraph/data:/var/opt/sourcegraph \
sourcegraph/server:2.4.3
  1. Go to http://192.168.99.100:7080 (or whatever IP your docker-machine cluster is using) in your web browser, not http://localhost:7080.

We will look into documenting or improving this on our end.

@sqs
Copy link
Member Author

@sqs sqs commented Feb 4, 2018

@creack confirmed that the workaround above worked.

@KelSolaar
Copy link

@KelSolaar KelSolaar commented May 18, 2018

I have a similar issue on my NAS, I have tried to make the paths fully writable on it without success:

✱ Sourcegraph is initializing the internal database... (may take 15-20 seconds)
Setting up postgres failed:

$ mkdir -p /var/opt/sourcegraph/postgresql

$ chown postgres /var/opt/sourcegraph/postgresql

$ su-exec postgres initdb -D /var/opt/sourcegraph/postgresql --nosync
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: could not access directory "/var/opt/sourcegraph/postgresql": Permission denied
exit status 1

image

@sqs
Copy link
Member Author

@sqs sqs commented Oct 25, 2018

@KelSolaar Did you ever find a fix or workaround for this?

@sqs sqs added this to the Backlog milestone Oct 25, 2018
@nicksnyder
Copy link
Member

@nicksnyder nicksnyder commented Jan 18, 2019

Closing since this is very old

@nicksnyder nicksnyder closed this Jan 18, 2019
keegancsmith added a commit that referenced this issue Apr 1, 2020
- ef3ec23 zoekt-webserver: sourcegraph disk prometheus metric
- d7ab4e5 Merge remote-tracking branch 'gerrit/master'
- 30af23a build-deploy: use bash interpreter
- 172db89 gitindex: remove ignoreMissingSubmodules field
- 444c275 add tini to Dockerfiles
- 16fa237 ci: build and push docker images (#42)
- 4b034fd remove vendor
- 63d51fa github: add go test workflow (#41)
- 52a2f11 gitindex: set git username and email in tests
- ebb2468 gitindex: set git username and email in tests
- 339fc57 go mod vendor
- 94908aa Merge remote-tracking branch 'gerrit/master'
- e55b1e7 shards: prometheus metrics for sharded search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants