8000 GitHub - joshgamble/docker-compose-ghost-setup: This is a project providing a Ghost CMS setup with docker compose, Mysql 8, NGINX and Certbot.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

This is a project providing a Ghost CMS setup with docker compose, Mysql 8, NGINX and Certbot.

License

Notifications You must be signed in to change notification settings

joshgamble/docker-compose-ghost-setup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Compose Quickstart for Ghost Blogging Platform

PRs Welcome MIT License

Quick start docker compose that include Ghost blog, Nginx proxy with TLS/SSL and MySQL database. The intention is to get a general feel of depolying Ghost in production mode, where each component (Web, App & DB) are deployed seperately. This supports scaling and isolate failure (if any).

If you want to test Ghost in dev mode, you can run docker compose -f ./dev/docker-compose.dev.yml or use the Ghost CLI.

npm install -g ghost-cli@latest # Install Ghost
ghost install local # Running on Dev

Table of Contents

Why using this in production environment?

☝️ Easy setup

👨‍💻 Ready to production and local development

⚡ Performance Optimized

🔒 SSL auto-renewed

Operating ENV

  • Operating System Ubuntu is the default OS. Use 20.04 or newer.

  • docker Docker version 20.10.23, build 7155243.

  • docker-compose Docker Compose version v2.15.1.

Technology Stack

  • Node.js
    • Ghost blog software version 5.x (defaults to latest version).
  • NGINX
    • proxying port 80 calls to the Node web server on port 2368.
  • MySQL database
    • version 8.0.
    • using UTFMB4 encoding (UTF8, actually). MySQL's UTF8 implementation is limited. UTFMB4 includes Emoji, try using it.

Preparation

  • A server sitting somewhere, like Amazon EC2 , Google Compute Cloud or a virutal machine (VPS) connected to your own network.
  • Register a domain name (either public or within your own network).
  • Access to your domain's DNS.
  • Make sure your DNS domain points to your host machine.

How to Use It

  1. Clone this project into the server's filesystem.
  2. And .env file with the following variables:
  GHOST_APP_DOMAIN=yourdomain.com
  ROOT_PSD=rootpswrd
  MYSQL_DATABASE=ghostdb
  MYSQL_DATABASE_USER=ghost
  MYSQL_PASSWORD=mysqlpswd
  ENVIRONMENT=production
  EMAIL_ADDRESS=mail@yourdomain.com
  1. Edit settings in config.<>.json and docker-compose.yml as necessary and only if you wish, as it is not required.
    • config.production.json and update the fields as required
    • Database Initial set-up settings - under ghost and mysql services in docker-compose file, indicate the env variables
  2. Run cd docker-compose-ghost-quickstart && sudo chmod +rwx setup.sh.
  3. Execute the setup script. ./setup.sh.

How start using locally?

In your local environment you need to have installed:

  • Docker
  • Docker Compose

After clone this repository, you can access the dev folder to be able to run the local dev environment using this command below.

git clone https://github.com/clean-docker/ghost-cms.git ghost
cd ghost/dev
docker-compose up -d

Done! Access your https://localhost/ghost to access the admin panel and create your account.

How to back up your database

  1. Run "docker-compose ps" to get a list of running containers.
  2. Locate the name of the mysql container.
  3. Run this command to get the container's internal IP: docker inspect --format='{{.NetworkSettings.IPAddress}}' THAT_CONTAINER-NAME
  4. In your favorite database GUI tool (like Navicat or DataGrip), create a new connection via SSH tunnel to the host machine
  5. Use the internal IP address and database user and password to connect to database once SSH tunnel is established to host.
  6. You'll have access to the data so you can view data and run backups.

Install Theme

Stop docker-compose with: docker-compose stop

Copy the new theme to ./ghost/content/theme so that your theme folder sits next to the casper folder in the themes directory

Now run: docker-compose up -d

Log in to the Ghost admin, go to Settings > General, and at the bottom is the Theme dropdown. Select your theme and click Save.

How does that work?

The ./ghost/content directory (on docker host machine) gets mounted inside your ghost container folder /var/lib/ghost when the container starts running. See docker-compose.yml for more details

Security and Networking

  • Only NGINX's ports (443) are exposed at host level.
  • Support only TLS version 1.2 for incoming traffic
  • HTTP/2 Enabled for Nginx Reverse Proxy

License

MIT LICENSE

References

Script Commands

Commands Description
./scripts/dc start Start your containers
./scripts/dc stop Stop all containers
./scripts/dc update Get Ghost updates and restart containers

About

This is a project providing a Ghost CMS setup with docker compose, Mysql 8, NGINX and Certbot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 91.5%
  • Makefile 8.5%
0