Hello,
I installed Ghost via a Docker installation and am now very satisfied. I used the following as Docker-Compose code:
version: '3.1'
services:
ghost:
image: ghost:4-alpine
restart: always
ports:
- 8080:2368
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: example
database__connection__database: ghost
# this url value is just an example, and is likely wrong for your environment!
url: http://localhost:8080
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
#NODE_ENV: development
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
I’ll have that with docker-compose up -d
started.
My question is how do I now correctly add the SMTP configuration to this file.
@hostingpeep
Thanks for your answer - I added the code to my configuration file, but whenever I start the container I can no longer open the port (8089 in my case) - it is no longer displayed in Portainer either. Do you know what’s up?
Best regards!
version: '3.1'
services:
ghost:
image: ghost:latest
restart: always
ports:
- 8780:2368
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: example
database__connection__database: ghost
# this url value is just an example, and is likely wrong for your environment!
url: http://IP-ADRESS:8780
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
#NODE_ENV: development
volumes:
- ./content:/var/lib/ghost/content
- ./config.production.json:/var/lib/ghost/config.production.json
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
Everything that’s in the config file can be set via env vars and vice-versa. You should choose one method that suits how you want to set up your container rather than defining things twice and adding confusion over what is set where.
If you get rid of the config file you can keep your docker config and add the mail options, e.g.
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: example
database__connection__database: ghost
# this url value is just an example, and is likely wrong for your environment!
url: http://localhost:8080
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
#NODE_ENV: development
mail__from: "'MyDomain' <postmaster@mail.mydomain.com>"
mail__transport: "SMTP"
mail__options__host: "smtp.mailgun.org"
mail__options__port: 465
...
@Kevin
Thanks for the quick reply - I have now configured it this way (I added the email address and password to it)
And I can’t even tell you how grateful I am to you for this working answer!
But I have one more request:
It’s best to write exactly what you sent me somewhere in the config file - then it will be much easier for many people to do the right configuration.
Thanks!