This page lists instructions to setup a medAL-data server instance and is intended to be read carefully by the entities involved in setting up the various components of the medAL suite.
You will need the following material:
Firstly, open up two terminals [t_local] and [t_remote] on the controlling workstation, on [t_remote] connect to the root account of the remote server using ssh:
ssh root@example.com
To setup Docker on the remote server, follow this procedure:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
You will see an output like the following:
docker-ce: Installed: (none) Candidate: <version-number> Version table: <version-number> 500 500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
sudo apt install docker-ce
sudo systemctl status docker
For more information, you can check on this site (https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04)
To setup Nginx on the remote server, follow these steps:
sudo apt install nginx
sudo ufw allow 'Nginx Full'
To setup Dokku on the remote server, follow these steps:
wget https://raw.githubusercontent.com/dokku/dokku/v0.24.10/bootstrap.sh sudo DOKKU_TAG=v0.24.10 bash bootstrap.sh
To get the latest verison go to https://dokku.com/docs/getting-started/installation/
example.com
where you will be able to setup the public SSH key used when deploying the source code to the server and optionnaly enable virtual hosting on the server:cat ~/.ssh/id_rsa.pub
, or generate a new one using:
ssh-keygen -t rsa
example.com
in the corresponding dialog box.Now, deploy your application by following this procedure:
# Create the App dokku apps:create medal-data # Install the postgres DB plugin sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres # Create Database dokku postgres:create medal-data-db # Link the App to the database dokku postgres:link medal-data-db medal-data # Set Config variables for Laravel dokku config:set medal-data DB_CONNECTION=postgres # Add the PHP buildpack to the apps config dokku config:set medal-data BUILDPACK_URL="https://github.com/heroku/heroku-buildpack-php" # Configure the storage folder of the server mkdir -p /var/lib/dokku/data/storage/medal-data mkdir -p /var/lib/dokku/data/storage/medal-data/framework mkdir -p /var/lib/dokku/data/storage/medal-data/framework/sessions mkdir -p /var/lib/dokku/data/storage/medal-data/framework/cache mkdir -p /var/lib/dokku/data/storage/medal-data/framework/views # give rights to herokuish chown -R 32767:32767 /var/lib/dokku/data/storage/medal-data dokku storage:mount medal-data /var/lib/dokku/data/storage/medal-data:/app/storage # set the scale of the application dokku ps:scale medal-data web=1 worker=1
git clone https://informatique_unisante@bitbucket.org/wavemind_swiss/liwi-main-data.git
, and navigate to the project folder:
cd liwi-main-data
.env.dokku.example
file and name it .env.dokku
: cp .env.dokku.example .env.dokku
and fill out the values depending on your desired configuration:
sudo nano .env.dokku
You can find an exhaustive list of environment variables here. Contact an administrator if you are not sure about any variable in this file.
/home/dokku/medal-data/ENV
.git remote add dokku dokku@example.com:medal-data git push dokku master
If the push did not work, then make sure you have correctly set up the SSH key on the dokku server using the web interface (more information on https://dokku.com/docs/deployment/user-management/).
APP_KEY
environment variable: dokku config:set medal-data APP_KEY=$(dokku run medal-data php artisan --no-ansi key:generate --show) --no-restart
dokku run medal-data php artisan passport:keys
.env
file. You can find an exhaustive list of environment variables here.dokku run medal-data php artisan config:cache
dokku run medal-data php artisan migrate:fresh --seed --force
dokku run medal-data php artisan 2fa:authenticate_all
and confirm by typing yes
. For more information about Two-factor authentication, click here.
dokku run medal-data php artisan medalc:retrieve_data
sudo dokku domains:set medal-data <domain>
where domain is the domain for medAL-data.
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
sudo dokku letsencrypt:enable medal-data
sudo dokku ps:restart medal-data