Readme - Deployify server for Docker on Ubuntu 18.x LTS or above

Docker is an engine that runs applications inside isolated containers. No OS littering and very easy to update without thinking of dependencies.

Think of it as popping in a CD/DVD in your computer. You can easily just remove the CD/DVD and knowing everything on the CD/DVD is removed from the computer. It's easy, right? Docker works in a similar way.

The installation script will install Docker for you.

You can run Docker on Windows too, with Docker Desktop and WSL. But that should only be for testing Deployify.

Deployify no longer supports Windows 7 due to a new library that use the native WebSocket namespace, which is not exposed on Windows 7.
 

Preparations:

  • Get a domain.
  • Add these subdomains and point them to your internet IP address:
    app.{domain}
    api.{domain}
  • In your router, forward port 80, 81, and 443 to your server IP address.
  • Make sure that the subdomain records are globally updated before running the install command, otherwise creating SSL certs will fail.

 

Installation:
 

sudo curl -L https://raw.githubusercontent.com/deployify/install-docker/master/extractor.txt | sudo bash -s {domain}


Example:

sudo curl -L https://raw.githubusercontent.com/deployify/install-docker/master/extractor.txt | sudo bash -s deployify.io


And if you want to include a web portal (Portainer) to manage Docker (optional):

sudo curl -L https://raw.githubusercontent.com/deployify/install-docker/master/extractor.txt | sudo bash -s deployify.io management

This is the address to the management portal: http://server-ip:9000


There is no problem to run the install script multiple times, even with different domain parameters (e.g if you misstyped the first time).

Yeah, that's it. Like magic.

 

Now what?
 

Your data lives here:

# Deployify data location
/var/lib/deployify

 

Global settings:

To change the global server settings, you first have to claim the global admin role. Read more here.

Global admin:

  1. Sign in.
  2. Click on "Global settings".
  3. Claim the global admin role.
  4. Sign out and in again.

Now you are able to change global server settings.

Read more about recommended settings here.

SSL:

If all is good and the domain is reachable from internet, then the proxy container will attempt to generate the SSL certificates for the subdomains listed in the preparations section.


Backup and restore:

First, make sure that you have the latest backup binary.

# download latest backup binary
cd /var/lib/deployify/
curl -L github.com/deployify/install-docker/raw/master/backup-linux -o backup-linux

 

Backup:

# backup
sudo /var/lib/deployify/backup-linux backup {output-file}


Restore:
Install Deployify properly before restoring a backup (follow the install instructions above).

# restore backup
sudo /var/lib/deployify/backup-linux restore {input-file}

 

Restore a backup that  was created from some of the other installation alternatives, like Windows (migrate to the newer database engine):
 

  1. Restore the backup, and then wait about one minute before proceeding to the next step.
  2. Stop DB container and API container.
    # stop api and db containers
    sudo docker stop deployify_neo4j 
    sudo docker stop deployify_api
    
  3. Download the migration script (anywhere), and run the script. Wait until the database is migrated and started (will be printed out).
    # download and run migration script
    curl -L https://raw.githubusercontent.com/deployify/install-docker/master/scripts/migrate_neo4j_4.0.0.sh -o migration.sh
    sudo chmod 700 ./migration.sh
    sudo ./migration.sh
    
  4. Press ctrl+c to end the script. Now, run the initiation script.
    # reload all docker containers
    cd /var/lib/deployify/scripts
    sudo ./init.sh
    

 

Done.

Optimize database memory:

Sometimes Neo4j need optimized memory configuration to run well. For example if the database is large or the computer doesn't have a lot of memory, Neo4j can fail to start. This is done when installing Deployify from 2021-04-04 and forward.

First, make sure that you have the latest backup binary.

# download latest backup binary
cd /var/lib/deployify/
curl -L github.com/deployify/install-docker/raw/master/backup-linux -o backup-linux


Then run this command:

# optimize database memory configuration
cd /var/lib/deployify/
sudo ./backup-linux optimize-database


It should all be done here, but if that command would fail for some reason (if Neo4j doesn't start for example), then you can try to run this command instead (2 is the RAM size of the computer in GB):

# optimize database memory configuration
cd /var/lib/deployify/
#change 2 to your computers RAM size in GB
sudo ./backup-linux optimize-database 2

 

Rerun this if the RAM size is changed, or after a while when the database size has grown.


Auto update:

The host is running a script once every 24/h that pulls Deployify images from the Docker hub (only downloading if a new is found), and if a new image was pulled, an initiation script executes. The initiation script is named init.sh and reloads the docker containers for Deployify. The script can be found here:

# script that reloads containers 
/var/lib/deployify/scripts/init.sh


This feature only updates the Docker images and reloads the containers, but does not perform a full installation like the installation script does. It can be a problem if a script has changed that reloads the containers for example, and in that case, you have to rerun the installation script. It ensures that all files are properly updated, and not only the images. As stated before, there is no problem to rerun the installation script as  many times as you want.


An automated backup is always performed before updating the Deployify containers, and can be found here:

# automatic backup location
/var/lib/deployify/backups


You can disable the auto update service with this command:

# disable auto update service
sudo systemctl stop deployify-updater
sudo systemctl disable deployify-updater


This script is looking for updates and is triggered by the auto update service above:

# update script, triggered by deployify-updater service
/var/lib/deployify/scripts/auto_updater.sh

 

Unseal Vault from Deployify website manually:

First, enable this feature in the global settings. Then move the key file to a safe location (not on the server).

# Vault keys location
/var/lib/deployify/data/vault/keys.json

 

The keys.json file will look something like this inside:
["asd98er0rt908df09ds09sdf", "12390a8sd90re908waasd098", "sad45fdewr897e89ga", "54098etrgfbv09834"]

Take each key (without quotations) and paste them in the form. Every key should be on its own row, so hit enter after each key you paste.

Like this:
asd98er0rt908df09ds09sdf
12390a8sd90re908waasd098
sad45fdewr897e89ga
54098etrgfbv09834

Then click "Unseal".
 

Basic Docker  commands
 

Good-to-know commands.

# list all containers
sudo docker ps -a
# show current log
sudo docker logs {container name/id}

 

Uninstallation:


Stop auto updater and remove Deployify from Docker:

# stop auto updater
sudo systemctl stop deployify-updater
# disable auto updater
sudo systemctl disable deployify-updater
# stop all deployify containers
sudo docker stop deployify_api
sudo docker stop deployify_site
sudo docker stop deployify_proxy
sudo docker stop deployify_neo4j
sudo docker stop deployify_vault
sudo docker stop deployify_management
# clean all deployify related from docker
sudo docker prune --filter "label!=deployify"


Remove all Deployify data, including backups:

# WARNING! this will delete all deployify data, including automatic backups
sudo rm -r /var/lib/deployify