User Tools

Site Tools


medal-data:setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
medal-data:setup [2022/01/14 14:37] arnaudpolettomedal-data:setup [2022/01/19 11:46] (current) arnaudpoletto
Line 1: Line 1:
 ====== medAL-data Setup ====== ====== medAL-data Setup ======
  
-==== Purpose and Scope ====+===== Purpose and Scope =====
  
 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.  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. 
Line 8: Line 8:
  
  
-==== Material ====+===== Material =====
  
 You will need the following material: You will need the following material:
Line 24: Line 24:
  
  
-===== Manual Installation ===== +===== Environment Setup =====
- +
-==== Environment Setup ====+
  
 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: 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:
 <code>ssh root@example.com</code> <code>ssh root@example.com</code>
 +
 +
 +
 +==== Install Docker ====
 +
 +To setup Docker on the remote server, follow this procedure:
 +
 +  - **[t_remote]** To update ubuntu server, type: <code>sudo apt update</code>
 +  - **[t_remote]** Install a few prerequisite packages which let apt use packages over HTTPS by typing: <code>sudo apt install apt-transport-https ca-certificates curl software-properties-common</code>
 +  - **[t_remote]** Add the GPG key for the official Docker repository to your system by typing: <code>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</code>
 +  - **[t_remote]** Add the Docker repository to APT sources: <code>sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"</code>
 +  - **[t_remote]** Update the package database with the Docker packages from the newly added repository: <code>sudo apt update</code>
 +  - **[t_remote]** Make sure you are about to install from the Docker repository instead of the default Ubuntu repository: <code>apt-cache policy docker-ce</code> You will see an output like the following: <code>
 +docker-ce:
 +  Installed: (none)
 +  Candidate: <version-number>
 +  Version table:
 +    <version-number> 500
 +      500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 +</code>
 +  - **[t_remote]** Finally, install Docker: <code>sudo apt install docker-ce</code>
 +  - **[t_remote]** Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running: <code>sudo systemctl status docker</code>
 +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)
 +
 +
 +
 +
 +==== Install Nginx ====
 +
 +To setup Nginx on the remote server, follow these steps:
 +
 +      - **[t_remote]** Install nginx: <code>sudo apt install nginx</code>
 +      - **[t_remote]** Enable nginx in the firewall by typing: <code>sudo ufw allow 'Nginx Full'</code>
  
  
  
  
-=== Dokku Installation on Remote Server ===+==== Install Dokku ====
  
-To setup the dokku installation, follow these steps:+To setup Dokku on the remote server, follow these steps:
  
   - **[t_remote]** Install dokku with the following commands: \\ <code>   - **[t_remote]** Install dokku with the following commands: \\ <code>
Line 42: Line 73:
 sudo DOKKU_TAG=v0.24.10 bash bootstrap.sh </code> To get the latest verison go to https://dokku.com/docs/getting-started/installation/ sudo DOKKU_TAG=v0.24.10 bash bootstrap.sh </code> To get the latest verison go to https://dokku.com/docs/getting-started/installation/
   - **[t_local]** On the local workstation, open a browser and head to your server domain ''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:   - **[t_local]** On the local workstation, open a browser and head to your server domain ''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:
-    If you already have a ssh key configured for git on your local workstation, then copy the value of the public key and paste in the dialog on dokku's web interface. If you already have a public key then you can copy the value output from the command: \\ <code>+   -  **[t_local]** If you already have a ssh key configured for git on your local workstation, then copy the value of the public key and paste in the dialog on dokku's web interface. If you already have a public key then you can copy the value output from the command: \\ <code>
 cat ~/.ssh/id_rsa.pub cat ~/.ssh/id_rsa.pub
 </code>, or generate a new one using: \\ <code> </code>, or generate a new one using: \\ <code>
 ssh-keygen -t rsa ssh-keygen -t rsa
 </code> </code>
-    Enter your domain name ''example.com'' in the corresponding dialog box +   -  **[t_local]** Enter your domain name ''example.com'' in the corresponding dialog box.
  
  
  
- 
-==== Application Setup ==== 
  
 === Application Deployment === === Application Deployment ===
Line 88: Line 117:
   - **[t_local]** Do a copy the ''.env.dokku.example'' file and name it ''.env.dokku'': \\ <code>   - **[t_local]** Do a copy the ''.env.dokku.example'' file and name it ''.env.dokku'': \\ <code>
 cp .env.dokku.example .env.dokku </code> and fill out the values depending on your desired configuration: \\ <code> cp .env.dokku.example .env.dokku </code> and fill out the values depending on your desired configuration: \\ <code>
-sudo nano .env.dokku </code> Then copy the file content to your clipboard. +sudo nano .env.dokku </code> You can find an [[variables|exhaustive list of environment variables here]]. Contact an administrator if you are not sure about any variable in this file. 
 +  - **[t_remote]** Copy the file content to your clipboard. 
   - **[t_remote]** On the remote server, paste the content at the end of the following file: ''/home/dokku/medal-data/ENV''.   - **[t_remote]** On the remote server, paste the content at the end of the following file: ''/home/dokku/medal-data/ENV''.
   - **[t_local]** Link and deploy the server with the following git commands (replace //example.com// with your own domain name): \\ <code>   - **[t_local]** Link and deploy the server with the following git commands (replace //example.com// with your own domain name): \\ <code>
Line 102: Line 132:
   - Make sure that to setup the ther environment variables properly in your ''.env'' file. You can find an [[variables|exhaustive list of environment variables here]].   - Make sure that to setup the ther environment variables properly in your ''.env'' file. You can find an [[variables|exhaustive list of environment variables here]].
   - Refresh the configuration: \\ <code>   - Refresh the configuration: \\ <code>
-dokku run medal-data php artisan config:cache+dokku run medal-data php artisan config:cache</code>
   - **[t_remote]** Finally, migrate and seed the database using: \\ <code>   - **[t_remote]** Finally, migrate and seed the database using: \\ <code>
 dokku run medal-data php artisan migrate:fresh --seed --force dokku run medal-data php artisan migrate:fresh --seed --force
Line 109: Line 139:
 dokku run medal-data php artisan 2fa:authenticate_all dokku run medal-data php artisan 2fa:authenticate_all
 </code> and confirm by typing ''yes''. For more information about Two-factor authentication, click [[administrator-guide#Two-Factor authentication|here]]. </code> and confirm by typing ''yes''. For more information about Two-factor authentication, click [[administrator-guide#Two-Factor authentication|here]].
 +
 +  - **[t_remote]** If you need to export existing data from medal-//creator//, run: <code>dokku run medal-data php artisan medalc:retrieve_data</code>
 +
 +
 +
 +
 +===== Domain Setup =====
 +
 +  - **[t_remote]** On your server terminal, set domain: <code>sudo dokku domains:set medal-data <domain></code> where domain is the domain for medAL-data.
 +
 +
 +
 +
 +===== Setting up letsencrypt with Dokku =====
 +  - **[t_remote]** On your server terminal, install letsencrypt plugin with: <code>sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git</code>
 +  - **[t_remote]** Install certificate with <code>sudo dokku letsencrypt:enable medal-data</code>
 +  - **[t_remote]** Restart the server: <code>sudo dokku ps:restart medal-data</code>
 +  - Open your browser and test the system. Make sure to setup the Two-factor authentication before logging in. You should be able to login with the admin credentials using the email address //admin@dynamic.com//. Contact an administrator to know the default admin password.
medal-data/setup.1642167431.txt.gz · Last modified: 2022/01/14 14:37 by arnaudpoletto