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

Update Ghost readme with Apache2 setup #2280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion ghost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ version: '3.1'
services:

ghost:
image: ghost:4-alpine
image: ghost:5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to adding these updates to the docker-compose yaml file, but they do need to be in ghost/stack.yml since the ghost/README.md file is generated.

Technically, the compose file will work as-is on docker-compose while still preserving the image-defined volumes when creating new containers (thus preserving state), they just won't have "pretty" names to keep track of them.

restart: always
ports:
- 8080:2368
Expand All @@ -164,18 +164,52 @@ services:
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
volumes:
- ghost-data:/var/lib/ghost/content

db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- db-data:/var/lib/mysql

volumes:
ghost-data:
db-data:
```

[![Try in PWD](https://github.com/play-with-docker/stacks/raw/cff22438cb4195ace27f9b15784bbb497047afa7/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/docker-library/docs/57f9907ee5bbeaede8c97f439b9c11bc1081dd75/ghost/stack.yml)

Run `docker stack deploy -c stack.yml ghost` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8080`, `http://localhost:8080`, or `http://host-ip:8080` (as appropriate).

### Production mode with Apache2 as reverse proxy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a general reverse proxy setup, so not something we want to focus our very limited documentation on.

You must update your configuration file, copy-and-paste the below block of configuration, amending it to suit your needs:
```
<VirtualHost *:*>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass "/" "http://127.0.0.1:8080/"
ProxyPassReverse "/" "http://127.0.0.1:8080/"
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
</VirtualHost>
```
For the proxy feature you should install:
```sh
sudo apt-get install libapache2-mod-proxy-html
sudo a2enmod proxy
sudo a2enmod proxy_html
sudo a2enmod proxy_http
sudo a2enmod headers
sudo service apache2 restart
```

# Image Variants

The `ghost` images come in many flavors, each designed for a specific use case.
Expand Down