Ghost is an open source publishing platform which is beautifully designed, easy to use, and free for everyone.
Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.
So let's Dockerize our Ghost platform . ( Docker host is Debian 8 - 192.168.0.100 )
curl -fsSL https://get.docker.com/ | sh
Step 2 - Creating required ghost platform folders on the host :
mkdir -p /var/lib/ghost/content/{data,apps,themes,images}
Step 3 - Editing Ghost config file ( config.js )
cd /var/lib/ghost/content/
wget -c https://raw.githubusercontent.com/TryGhost/Ghost/master/config.example.js
vim config.example.js
change the url to your production url , the host to 0.0.0.0 and add paths
config = {
// ### Production
// When running Ghost in the wild, use the production environment.
// Configure your URL and mail settings here
production: {
url: 'http://192.168.0.100',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
host: '0.0.0.0',
port: '2368'
},
paths: {
contentPath: path.join(__dirname, '/content/')
}
},
Step 4: defining ghost Environment File
vim /etc/default/ghost
#Im using my host ip here instead of my domain name . use your domain name in production.
GHOST_URL=http://192.168.0.100
MAIL_FROM='"Webmaster" <webmaster@example.com>'
MAIL_HOST=mail.example.com
PROD_FORCE_ADMIN_SSL=true
MAIL_SSL=true
MAIL_PORT=465
MAIL_USERNAME=ghost@example.com
MAIL_PASSWORD=mypassword
Step 5 : Running our container with our customised environment variables and config.js file . We map /var/lib/ghost/content in our host to /var/lib/ghost in our container so that we never lose data if we destroy container . we publish port 2368 as well .
docker run --name myghost --env-file /etc/default/ghost -p 80:2368 -v /var/lib/ghost/content/:/var/lib/ghost -d gold/ghost npm start --production
Step 6 : verification
docker ps
http://yourdockeripaddress
Comments
Post a Comment