Replicable configurations for our services.
This README is here for people to migrate the server in the future or run a clone for testing purposes.
- A linux workstation with docker-machine
- A target Ubuntu 20.04 x86_64 server (Newer ubuntu versions might work aswell).
- Two S3 compatible object storage buckets with glacier support (for backups).
This is not configured by the script, so it has to be done manually before running install.sh.
This is just my current configuration, you don't need to respect this layout exactly.
Actually, you can just ignore it, and install the server on a single disk. As long as the paths are resolved it will work.
- Generic storage:
/
- Non incremental backups path:
/backups
- Non incremental backups path:
- Replicated storage:
/srv
- Swap:
/swapfile1
$ mkdir -p /srv
$ mkdir -p /backups
$ lsblk
# Find the volume
$ mkfs.ext4 /dev/sda
$ lsblk -f
# Get UUID
$ nano /etc/fstab
# Add UUID=DISKUUID /srv ext4 defaults 0 0
$ mount -a
$ mount | grep /srv # Check if fs is mounted
# Swap
$ fallocate -l 1G /swapfile1
$ chmod 600 /swapfile1
$ mkswap /swapfile1
$ swapon /swapfile1
$ echo '/swapfile1 none swap sw 0 0' | tee -a /etc/fstab
$ cat /etc/fstab # Check if swap is added
$ free -h # Check if swap is loaded
This is a reference to know what is backuped and how, the scripts take care of setting up the backup policy.
- Always full backup path:
/backups
- Incremental backup path:
/srv
- Exclusions
/srv/mysql_data
/srv/hub
- Exclusions
- Copy config.template.sh into config.sh
- Edit config.sh
Running ./install.sh generates or updates the server.
INSTALL="all" HOST_SETUP=1 ./install.sh
INSTALL="all" HOST_SETUP=1 RESTORE=1 ./install.sh
INSTALL="all" SKIP_CERTS=1 ./install.sh
INSTALL="nginx_gateway" ./install.sh
- HOST_SETUP="1" : Install and configure all the required supporting software on the host, setup backup policies. mail alerts, updates etc. DEFAULT VALUE: ""
- NO_RESTART="1" : Do not reboot macking after HOST_SETUP is complete. DEFAULT VALUE: ""
- RESTORE="1" : Restore the last backup. DEFAULT VALUE: ""
- SKIP_CERTS="1" : Use the placeholder certificates instead of generating valid certificates as part of the installation process. This is useful when replicating the server locally or on an host to which the domains are not pointing yet. It is possible to regenerate the certificate later by reinstalling the nginx_gateway. DEFAULT VALUE: ""
- INSTALL="service" : Install reinstall or update one of the services configured in init/installers. DEFAULT VALUE: "all" to install all.
- Configure the container to check its health (see docker documentation, --health-cmd)
- Add the container name to /init/installers/healthcollector/healthcollector.data
- Reinstall healthcollector-inst
- init/ contains all the management scripts.
- config/ contains all the configurations
- www/ contains static files
This is done automatically by a cronjob. If needed you can trigger a backup manually with:
./backup-remote.sh
: For a full backup./backup-remote.sh incremental
: For an incremental backup
This is a secondary encrypted backup location shared with the core team.
Create a GDRIVE rclone config locally ( https://rclone.org/drive/ )
cat ~/.config/rclone/rclone.conf
take note of client_id, client_secret, token, root_folder_id
and add them to the config.sh
export GDRIVE_BACKUP_FOLDER_ID=""
export GDRIVE_BACKUP_TOKEN = ''
export GDRIVE_BACKUP_CLIENT_ID = ''
export GDRIVE_BACKUP_CLIENT_SECRET = ''
- cd /srv/hub/
- ./launcher enter app
- rake admin:create
- Insert your email
- Grant the privileges
- Done!
- cd /srv/hub
- Change in containers/app.yml
- ./launcher enter app
- rake posts:rebake
- cd /srv/hub
- ./launcher enter app
- rake posts:remap["original","replacement"]
- cd /srv/hub
- ./launcher enter app
- rake search:reindex
- cd /srv/hub
- ./launcher enter app
- su - postgres
- psql discourse
- VACUUM FULL;