📜 ⬆️ ⬇️

Starting your blog on Ghost using docker-compose

Ghost + docker
Ghost is a very powerful and at the same time concise blogging platform, and docker-compose is an excellent tool for installing and configuring programs using a single .yml file. In this article I want to briefly talk about how we quickly set up a blog for our project using docker-compose.


Let's start!


First, check that docker and docker-compose installed on your machine. The commands below should display the versions of these utilities.


 docker -v docker-compose -v 

The Docker Hub has an official image with Ghost , which we will use in our docker-compose.yml file.


Create a docker-compose.yml file


 touch docker-compose.yml 

And insert the following lines into it


 version: '2' services: web: restart: always image: ghost ports: - "80:2368" volumes: - {path_to_save_ghost_data}:/var/lib/ghost 

{path_to_save_ghost_data} with the path in which Ghost will store its configuration and database, for example, I have this /home/administrator/ghost .
Everything is ready to run Ghost on your machine:


  docker-compose up -d 

I suggest to check that Ghost wound up and works. Open the address of the machine on which Ghost is installed in your browser - you should see the standard greeting.


Ghost initial page


In principle, Ghost works and you can leave everything as is, but I recommend adjusting the configuration a bit.


Stop our blog:


  docker-compose down 

Open the configuration file located at {path_to_save_ghost_data}/config.js , in my case this is /home/administrator/ghost/config.js .
Let's find the development section (yes! Not production , because for some reason it is impossible to launch Ghost in production mode inside Docker, if you know the way to tell about it in the comments).
Specify the address of your blog and the address of the sender, should get something like this:


 development: { url: 'https://blog.ambar.cloud', //    mail: { from: 'hello@ambar.cloud', //   }, database: { client: 'sqlite3', connection: { filename: path.join(process.env.GHOST_CONTENT, '/data/ghost-dev.db') }, debug: false }, server: { host: '0.0.0.0', port: '2368' }, paths: { contentPath: path.join(process.env.GHOST_CONTENT, '/') } }, 

Let's start a blog and check that everything works.


 docker-compose up -d 

That's all, thank you for your attention! In the next article I will tell you how to quickly configure OpenVPN using docker-compose.


')

Source: https://habr.com/ru/post/325868/


All Articles