-
Notifications
You must be signed in to change notification settings - Fork 1
Server Upgrade Guide
Carl Smith edited this page Aug 10, 2023
·
1 revision
Quickly stop, start, and re-start Conforma instances on pre-configured servers.
For a detailed overview of the processes that these scripts automate, please see Demo Server Guide
- Login (with SSH) to the server
- Set the tag of the latest build Docker image:
export TAG='<build-tag>- If
$TAGis not specified, you will be prompted for it when launching
- If
- Relaunch whichever instances you want to upgrade to this build:
launch_conforma <instance-names, ...>
e.g.launch_conforma 50000 50004- The "instance-names" must correspond to a pre-configured
.envfile found in~/demo_server/env_files - If instances are omitted, you will be prompted for one, or you can let it use a pre-configured default
- The launch script will automatically pull the build image from Docker hub if not already present, and stop the instance before re-launching if it's already running.
- The "instance-names" must correspond to a pre-configured
- To stop an instance (without re-starting):
stop_conforma <instance-names, ...>
Please see the script files launch.sh and stop.sh (/docker/demo_server in repo) to see what they're doing.
How to set up server in order for the above commands to work:
- Ensure server has the latest version of Docker installed, and nginx has been configured as per the Demo Server Guide
- If it doesn't already exist, create a directory
demo_serverin the home folder:
mkdir ~/demo_server - In the
demo_serverdirectory, create the following files and make sure their contents match the ones indocker/demo_serverfrom this repo.docker-compose.ymllaunch.shstop.sh
- If you want, you can change (or remove) the
DEFAULT_INSTANCEvalue inlaunch.shandstop.sh - Create directory:
~/demo_server/env_files - In that directory, create an .env for each instance of Conforma you want to have running on this server. The name of the file is what you will pass into the launch commands from the earlier section.
e.g.50000.env,fiji_demo.env, etc... - Populate each of the
.envfiles with the following (example) environment variables:Note:PORT=8004 SMTP_PASSWORD='<password>' WEB_HOST='https://conforma-demo.msupply.org:50004' BACKUPS_FOLDER='~/demo_server/backups/50004' BACKUPS_PASSWORD='<password>'
-
PORT,SMTP_PASSWORD&WEB_HOSTare required; the other two are optional as they have default values. - see the Demo Server Guide for specifics of what these variables refer to.
-
- Lock down the permissions on all the above
.envfiles -- because they contain sensitive information, we want them to be as inaccessible as possible:sudo chown root:root <file> #Make "root" the owner sudo chmod 700 <file> #Only owner(root) can access
- Create command aliases for the launch/stop scripts and add them to the bash configuration:
- Edit config file:
nano ~/.bashrc - Add the following lines:
Note: thealias launch_conforma='sudo -E ~/demo_server/launch.sh' export launch_conforma alias stop_conforma='sudo ~/demo_server/stop.sh' export stop_conforma
sudois required so the scripts have access to the.envfiles (which are restricted to root), and the-Eflag ensures the active$TAGenvironment variable is accessible - Edit config file:
Powered by mSupply