Closed dalanmiller closed 7 years ago
Yep, I just lost a few hours to the contentPath
issue which was pretty frustrating.
Here is the notes I added on in my Dockerfile
. Once you get the pattern, you're good to go!
## Good to know: ENV GHOST_SOURCE /usr/src/ghost
## Good to know: ENV GHOST_CONTENT /var/lib/ghost
## Good to know: WORKDIR $GHOST_SOURCE
## root@ec780f67ae5a:/var/lib/ghost#
##
## The Directory structure is NOT the same as the original ghost ...
## ... there is no content directory
## apps config.js data images storage themes
## theme are here > /var/lib/ghost/themes
## not in /var/lib/ghost/content/themes
This is still true for the 1.x version of the container: there is no (elegant) way to mount the "config.production.json" file – which is needed to e.g. set the base URL.
@nicokaiser not true 😉 with ghost 1.0 comes the ability to configure your instance via environment variables - this is the intended way of doing things with ghost 1.x in Docker. See the docs for more information.
@acburdine That sounds great, did not know about this!
However, it does not work. I set the "URL" environment, yet it is ignored (same if I manually run "URL=... node current/index.js" in the container). Am I missing something?
It's a bit odd, but it needs to be a lowercased environment variable, e.g. url
rather than URL
Awesome, that works! Thank you @acburdine!
Please consider mentioning this (the option to set configuration options via the environment variables) in the Readme for the image. Many people are likely to bump into this. Thanks.
The docs don't specify how to configure mail settings via env.
:+1: for the official ghost doc a bit lacking about mail (like gmail or custom mail). And docker's README.md missing a hints for this kind of configuration.
@justinoverton I'm was able to turn privacy on via privacy='"privacy": {"useTinfoil": true}'
. I guess you can put a flat json following https://docs.ghost.org/docs/mail-config for mail config
It's a bit odd, but it needs to be a lowercased environment variable, e.g. url rather than URL
@acburdine I used the official ghost:1.7.0-alpine
image, and I tried to start a container with
docker run --rm -it \
-p 2368:2368 \
-e url="https://MY_URL" \
-v /mnt/docker/ghost:/var/lib/ghost/content \
ghost:1.7.0-alpine
If I curl https://MY_URL, it responds with a redirect to localhost:2368.
Is the env variable working only if you built the image from this dockerfile? (It would be nonsense, as I assume that the official image is the result of building this dockerfile).
It would also be nonsense having to build a dockerfile just to change this settings.
Is there something I'm missing?
Do you need to set the entrypoint/cmd manually when starting the container?
@dexafree : url env worked with ghost:latest for me
@dexafree Indeed, your issue is that you provided the url between double quotes. There shouldn't be any.
I'm running
docker run -e url=http://eclats-de-voix.fr/ -d --name blog.eclats-de-voix-2 -p 3003:2368 -v /var/www/blog.eclats-de-voix:/var/lib/ghost/content ghost:1.12.1-alpine
and it works fine. I tried first with your example (with double quotes) and it failed. ;)
Just chiming in here, as I was having trouble setting up the mail variable, but figured out a bit more. As usual, the answer had been staring me in the face for the past hour!
The key line from the documentation is:
For nested config options, you'd need to separate them with two underscores:
A configuration that looks like:
"mail": {
"transport": "SMTP",
"options": {
"service": "Mailgun",
"auth": {
"user": "postmaster@ur.mailgun.com",
"pass": "doremiabc123"
}
}
}
Should have 4 independent variables set. My corresponding kubernetes deployment config would look like:
- name: mail__transport
value: SMTP
- name: mail__options__service
value: Mailgun
- name: mail__options__auth__user
value: postmaster@ur.mailgun.com
- name: mail__options__auth__pass
value: doremiabc123
I'm currently trying to get Ghost working on my Kubernetes cluster.
The main problem I'm having is that I can't load
config.js
into the correct spot and while I can do/var/lib/ghost/content
Ghost blog is expecting a lot more files than the minimum stated by the README.So two things:
config.js
file into/usr/src/ghost
/var/lib/ghost/
and ifconfig.js
can also be put there?config.js
need to be changed since at the moment the default ones break becausecontentPath
and the db path aren't setup correctly for Docker setups.