The site on the internet: server, domain and HTTPS
So far the site lives on your computer. Let’s move it to a server, connect a domain and turn on HTTPS. You’ll need a Linux server and a domain, and Eile does the rest by itself.
Server and domain
You need a small virtual server (VPS) with Linux: the cheapest plan with 1 GB of memory at any hosting provider will do. When you order it, choose Ubuntu or Debian. The host sends you the server’s IP address, for example 203.0.113.10, and the password for the root user.
You buy a domain from a registrar. This chapter uses facade.example; put your own domain wherever you see it. In the domain’s DNS settings, create two A records, one for facade.example and one for www.facade.example, both with the server’s IP address. The records take anywhere from a few minutes to a couple of hours to spread across the internet.
Log in to the server
You talk to a server over SSH. It’s the same terminal, except the commands run on another computer. In the terminal on your own computer, type:
$ ssh root@203.0.113.10Enter the password from your host. The prompt changes: from now on, your commands go to the server. Install Eile the same way as in chapter two:
$ curl -fsSL https://github.com/a-sharapov/eile/releases/latest/download/install.sh | bashWhen you install as root, the program goes to /usr/local/bin/cms. Leave the server with the exit command:
$ exitMove the site
The whole site is in site.db. First make a copy of it on your computer, in the facade folder:
$ cms backup facade-copy.dbYou can make the copy while the site is running: it comes out complete, with no half-written records. Email, Telegram and the mail gateway belong to this computer, not the site, and are not part of the copy. If you have set them up already, take them along in a server settings file:
$ cms backup --server facade-server.encThe command asks for a passphrase twice, at least 12 characters: the file is encrypted with it, since it holds the mail password and the bot token. Now send both files to the server with scp, a command that copies files over SSH:
$ scp facade-copy.db facade-server.enc root@203.0.113.10:Run it as a service
If you start cms in the server’s terminal, the site stops as soon as you close the window. That’s why it runs as a service: Linux starts it when the server boots and restarts it if something goes wrong. Eile creates the service by itself. Log in to the server again and run one command, replacing the domains and the email with your own:
$ ssh root@203.0.113.10
$ cms service install --domain facade.example,www.facade.example --email you@example.com --from facade-copy.db--domain facade.example,www.facade.example: the addresses the site lives at. Eile gets an HTTPS certificate for them from Let’s Encrypt by itself, renews it and sends visitors from http to https.--email: Let’s Encrypt writes to this address if something is wrong with the certificate.--from facade-copy.db: the copy of the site you brought along. Eile moves it to/var/lib/cms/site.db, and after that you can deletefacade-copy.db.
First the command checks that the domains point to this server, that ports 80 and 443 are free and that there is enough memory. If something is wrong, it tells you what to fix. Then it creates the service, starts it and waits for the site to answer. At the end you see ✓ The service cms is running with the addresses of the site and the manager.
After a minute, open https://facade.example: the site is there, with a padlock in the address bar. The manager is at https://facade.example/manager, and you sign in with the same email and password you used at home, because they moved along with the database.
What’s left is the server settings from the file. The command asks for the same passphrase:
$ cms restore --server facade-server.enc --db /var/lib/cms/site.dbEmail, Telegram and the mail gateway work right away: the service picks them up by itself, no restart needed. Then delete facade-server.enc from the server and from your folder: it is only for the move. If you have no such file, set up email and Telegram in the manager again.
cms service status shows how the site is doing. To see the service file without changing anything, add --print.
The site address in the settings
In the manager, open Settings → Site and enter the site address: https://facade.example. Eile uses it to build links for search engines, the sitemap and previews on social networks.
Backups
In Settings → Backups and updates, turn on automatic backups, for example once a day at three in the morning, keeping the last seven. The server makes them by itself. If a backup fails, you get a notification.
A backup that sits only on the same server won’t help if that server breaks. So in the same place, under Backups off the server, connect a storage: for example DigitalOcean Spaces at the same host, or Backblaze B2. Enter the storage address, the bucket, the access key and its secret, press Check connection and save. From now on every automatic backup goes to the storage encrypted, and the storage keeps the last fourteen.
Now and then, download a backup to your own computer too: it’s one button in the Backups section of the manager header.
Updates
When a new version of Eile comes out, the manager shows it in the account menu. Updating on the server takes one command:
$ cms updateIt downloads the new version, checks its checksum, does a test run and restarts the service. If the new version doesn’t come up, cms update puts the previous one back and tells you. Before you update an alpha version, it’s a good idea to make a backup with cms backup.