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

Additional config volume needed #36

Closed
3 tasks
dalanmiller opened this issue Jun 2, 2016 · 14 comments
Closed
3 tasks

Additional config volume needed #36

dalanmiller opened this issue Jun 2, 2016 · 14 comments

Comments

@dalanmiller
Copy link

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:

  • Allowance of mounting a config.js file into /usr/src/ghost
  • Documentation updates on all files are needed to be mounted under /var/lib/ghost/and if config.js can also be put there?
  • Also for better clarity, explain which variables in config.js need to be changed since at the moment the default ones break because contentPath and the db path aren't setup correctly for Docker setups.
@mwakerman
Copy link

Yep, I just lost a few hours to the contentPath issue which was pretty frustrating.

@pascalandy
Copy link
Contributor

pascalandy commented Sep 15, 2016

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

@nicokaiser
Copy link

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.

@acburdine
Copy link
Collaborator

@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.

@nicokaiser
Copy link

@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?

@acburdine
Copy link
Collaborator

It's a bit odd, but it needs to be a lowercased environment variable, e.g. url rather than URL

@nicokaiser
Copy link

Awesome, that works! Thank you @acburdine!

@cowchimp
Copy link

cowchimp commented Aug 6, 2017

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.

@justinoverton
Copy link

The docs don't specify how to configure mail settings via env.

@rgarrigue
Copy link

👍 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

@dexafree
Copy link

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?

@rgarrigue
Copy link

@dexafree : url env worked with ghost:latest for me

@Vadorequest
Copy link

Vadorequest commented Oct 11, 2017

@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. ;)

@alterationx10
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests