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

Projects
None yet
3 participants
@sqs
Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member Author

sqs commented Feb 4, 2018

@creack confirmed that the workaround above worked.

@KelSolaar

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member

nicksnyder commented Jan 18, 2019

Closing since this is very old

@nicksnyder nicksnyder closed this Jan 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.