mmornati / docker-ghostblog

Ghost Blog Docker Container
MIT License
10 stars 6 forks source link

Use the default node user instead of the ghost one #7

Closed mmornati closed 6 years ago

mmornati commented 6 years ago

To get compatibility with the official Docker Ghost it should be better to use the node user (already contained into the node base image used for the docker) instead the created Ghost one.

Update the document to allow users already using the image to migrate to the new version.

Proposed by @pascalandy

mmornati commented 6 years ago

For me it is working even without changing the ownership of the files because all the files were already owned by a local user with id 1000:

id myuser
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),27(sudo),999(docker)

which is also a user in the docker group. I let you test this new version.

pascalandy commented 6 years ago

EDIT: I tried but the container won't run.

I have found that the default db is named ghost-local.db

The official docker image uses ghost.db

pascalandy commented 6 years ago

EDIT: I tried but got an error.

In the Docker file FROM node:6 as ghost-builder. Would it make more sense to use the node:6-alpine image and add bash?

pascalandy commented 6 years ago

I discovered to root of my issue in prod. The health check is in the way as my site is serving https://mysite.net/news/

I think the / news is messing here. I simply bypass it in the Dockerfile :)

pascalandy commented 6 years ago

Here my challenge now. I tried to run the container on data that was running via ghost 1.16.0.

Ghost complains that it needs to install -g knex-migrator as it not found.

What I did is to add the command to the second builder but there is a permission issue there.

mmornati commented 6 years ago

@PascalAndy yes. It is because when the image runs ghost install there is the - - local parameter. I don't remember why I was using it in that way. I will try to change it

mmornati commented 6 years ago

@PascalAndy yes it seems ghost install is requiring a package which is not in the alpine. As it was on a different stage I thought it was not so important if the image was not alpine. But I will try to check how the default image works and try to fix it.

mmornati commented 6 years ago

@PascalAndy you can't install in that point cause you are using the node user and not the root one. You can install it without the -g and executed from the local folder.

I've done the same thing here: https://github.com/mmornati/docker-ghostdbmigrate/blob/master/Dockerfile

In your context are you able to use that different image for the database migration? Documentation here too: https://blog.mornati.net/how-to-update-to-ghost-1-9-0-with-docker/

I created that separated image to prevent space waste in the official one. The database migration is used only during some specific version migration and it is not necessary in production. But if it is not working in your case I can rethink to the way I'm injecting it.

mmornati commented 6 years ago

I think in the health check part there is an improvement to do (opened the Issue #10). But @pascalandy can you explain better your problem and the way you are starting the blog? The helthcheck is done internally so it should be possible to use it even if your public url is different. If you can share a part of your configuration.