Developers Club geek daily blog

2 years, 8 months ago
The main and only objective of Ghost — creation of the ideal blog. If Wordpress has stopped being simply blogs long ago and has turned into full-fledged CMS, Ghost – full opposition of Wordpress. It simply blog.

We develop the blog Ghost in InfoboxCloud

In this article we will consider installation process of Ghost in InfoboxCloud by means of Docker.

Use of Docker allows to develop very simply applications in the environments tested by developers and it is easy to perenostit if necessary between servers. Together with autoscaling in cloud it is possible to achieve the very high density of placement of applications on the server and the most effective use of resources.

Developing Ghost thus you have much bigger control over the blog, than when using Ghost as service.


Preparation of environment


1. Create the server with CentOS 7 for the Docker installation in InfoboxCloud. Virtual computer therefore at creation of the server surely set tick is now necessary "To allow management of OS kernel for work of Docker".

As it is correct to create the server in InfoboxCloud for Docker
If you still have no access to InfoboxCloud – order it.

After registration you obtain data for access to control bar to email. Enter control bar to the address: https://panel.infobox.ru

In the section "Cloudy Infrastructure" of your subscription click "The new server" (if necessary the subscription changes in the upper right corner in drop-down menu).

We develop the blog Ghost in InfoboxCloud

Set necessary server options. Surely select to the server 1 public IP address and set tick "To allow management of OS kernel", as shown in screenshot below.

We develop the blog Ghost in InfoboxCloud

Select CentOS 7 from the list of available operating systems and complete creation of the server.

We develop the blog Ghost in InfoboxCloud

After that data for access to the server will come to you to e-mail.

After creation of the server with CentOS 7 be connected to it on SSH.

We have prepared script which will allow you to set Docker and useful utilities for work with Docker on such server. Necessary tunings will be performed automatically.

Execute command for the Docker and Compose installation:
bash <(curl -s http://repository.sandbox.infoboxcloud.ru/scripts/docker/centos7/install.sh)

Docker and compose will be set.

It is possible to create image with the set docker in control bar, having clicked the server and further "To create image". After that from image with Docker it will be possible to create new servers and not to execute this step repeatedly.

Ghost installation


Create the folder in which files of the blog will be stored:
mkdir -p ~/sitename/blog

, where instead of sitename it is possible to write the address of your blog.

Create the file ~ / sitename/docker-compose.yml with the following contents:
sitename:
  image: ghost:latest
  ports:
  - 80:2368
  restart: always
  volumes:
  - ./blog:/var/lib/ghost

, where instead of sitename it is possible to enter name of your site also.

We specify in this file that it is necessary to construct the container docker of official image of ghost of the latest version, to forward internal port 2368 on public 80, always to restart the container in case of falling of services in it and to write files of database of the blog in the blog folder (that at reorganization of the container not to lose data).

If before Ghost you need to put the balancer — the example of creation of the connected containers with the balancer can be seen in this article.

If you do not know how to edit the file — details in this article in the section "How to Edit the Text File".
If it is interesting to you to deal with Docker Compose – details here.


Save the file ~ / sitename/docker-compose.yml and execute command:
docker-compose up -d
for expansion of the container with ghost.

Now you can enter your blog to the address:
http://ip–адрес вашего сервера

Ghost has been successfully set.

We develop the blog Ghost in InfoboxCloud

Initial setup of the blog


We will need to execute still quantity of settings of the blog.

Open the file ~ / sitename/blog/config.js on editing. In it there are different sections, we are interested in the section development. We will change all settings only in it, without touching the others.

We develop the blog Ghost in InfoboxCloud

Though Ghost supports options of start of "Development" and "Production", in Docker-template the blog in configuration Development is by default started. It says only that the section Development in the config.js file is used. Ghost is already set in configuration Production without excess dependences and is suitable for use in the prodakena. Let does not confuse you that we edit development configuration section. With the advent of Docker for development it is much more convenient to start the separate container, but not to configure some configurations in Ghost.

Our blog will be located for certain in some domain or subdomain. In DNS direct record A of the necessary domain (for example blog.frodo.com) on the public ip-address of the server which we have created for Docker. The public ip-address — to what you were connected on SSH.

In the file ~ / set to sitename/blog/config.js in the section development in url the address of your domain which will be used for the blog.

We develop the blog Ghost in InfoboxCloud

Now we need to configure possibility of sending e-mail the blog.

For sending letters Mailgun is recommended to use. Be registered in service. After that pass into the section "Domains" in the Mailgun control bar, add your domain. Further it will be necessary to add additional entries in the DNS domain about which will report service. After passing of verification of the domain you receive login and the password from e-mail in it. It can also be used for the blog. The section mail in config.js for Mailgun has to look as follows:
mail: {
transport: 'SMTP',
    options: {
        service: 'Mailgun',
        auth: {
            user: ' ',
            pass: ' '
        }
    }
}

On forget to specify yours login and the password from Mailgun.
Pay attention that we have deleted characters of comments//before every line of the mail section config.js.

Save changes. Now it is necessary to execute restart of our container that changes were applied.

For viewing of all started containers execute command:
docker ps

You can see the id-container, as shown in screenshot below:

We develop the blog Ghost in InfoboxCloud

Execute reset of the container on id:
docker restart e3acf62e49b4

, where replace e3acf62e49b4 with id of your container.

Now your blog is successfully configured!

We use Ghost


Enter panel of administration of Ghost to the address:
http://ip–адрес-сервера/ghost

Click "Create your account" for creation of account in Ghost.

We develop the blog Ghost in InfoboxCloud

Enter data for registration of account and click "LAST STEP: Invite your team".

We develop the blog Ghost in InfoboxCloud

On the last step you can invite team for editing the blog or it is simple to click "I'll do this later" under the Invite button.

We develop the blog Ghost in InfoboxCloud

Now it is possible to start writing articles.

We develop the blog Ghost in InfoboxCloud

How to receive trial version of InfoboxCloud it is free?


Send us your e-mail address and full name, in reply obtain data for access to control bar. You can test the new region of cloud within 15 days, further it is possible to pass to the full version of cloud.

If you have questions or notes, write to us and we with pleasure will answer.

Successful use of Ghost in InfoboxCloud!

This article is a translation of the original post at habrahabr.ru/post/266567/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog habrahabr.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus