Table of contents
Table of Contents |
---|
New installation
...
Foreword
Before running the backend installation commands, make sure your system have the following packages installed:
gnupg2 : GNU privacy guard - a free PGP replacement
pass : lightweight directory-based password manager
make : to be able to use the provided tool (Makefile) to install the backend
docker.io (or equivalent)
docker-compose (or equivalent)
To install those components, please use the following commands:
...
Admin privileges
Some backend installation commands will require admin priviledges. Make sure your current user is part of the sudoers group. Edit the /etc/sudoers file and add your user to it:
Code Block |
---|
<username> ALL=(ALL) ALL |
Ubuntu/Debian like systems
The installation process on Ubuntu/Debian like systems is quite easy.
Code Block |
---|
sudo apt install -y docker.io docker-compose gnupg2 pass make |
RedHat/
...
CentOS like systems
The installation process on those machines is a bit more complex.
Some packages are already part of the standard repository and can be installed right away.
Code Block |
---|
sudo dnf install -y gnupg2 |
Deliverables
The backend server comes as an archive which should contain at list 2 directories:
SAMDistImages
SAMDeployment
Local Docker repository
Create and launch a local Docker repository using the following script:
Code Block |
---|
docker run -d -p 5000:5000 --restart=always --name registry registry:2 |
Backend setup
Before running the installation sequence, one needs to update the installation scripts to:
Adjust some of the paths
Set personnal administor credentials and default database content
The first file to look into is
...
Retrieve the Dockers/SAMDeployment directory from the development project located at svn://svn.agnos.ca:3890/abc/Products/SamBackEnd/trunk into the environment where it will be installed.
...
make the SAMDeployment directory current.
...
Edit the Configuration.conf file. Set the parameters accordingly to your environment.
...
Replace the certificate (fullchain.pem) and the private key (privkey.pem) in the Server/resources directory with your own.
...
You must replace the APP_KEY in the Server/templates/laravel_env file. You can generate a new one using the following command:
Code Block |
---|
echo "base64:`dd if=/dev/random bs=32 count=1 | base64`" |
You can also generate a new one from the /var/www/html directory in the SAM backend container by running the command
Code Block |
---|
php artisan key:generate |
...
docker login dev.atheos.ca:5000
...
Initialize the permanent storage
Code Block |
---|
make initstorage |
...
Initialize the database
...
Code Block |
---|
make initdatabase |
...
Create the images
Code Block |
---|
make images |
...
Launch the SAM backend by issuing the following command.
Code Block |
---|
make run |
...
Optionally, install phpmyadmin for debugging purposes. It is not recommended. Customize the files fullchain.pem, passwd and privkey.pem in the resources directory. passwd is created with htpasswd. It contains the Apache2 passwords. Launch it by issuing the following commands:
Code Block |
---|
cd PhpMyAdmin
make images
make run |
Update of an existing Production installation
...
Preserve the file Configuration.conf from the previous SAMDeployment package.
...
Preserve APP_KEY value from the .env file in the Server Docker. If needed, update SAMDeployment/Server/templates/laravel_env. The value of APP_KEY must be preserved. If lost, you SAM backend environment will have many issues.
...
Stop the containers samserver_xx.yy.zz, samphpmyadmin_xx.yy.zz and samdatabase_xx.yy.zz
...
Make a backup of your storage structure set using the Configuration.conf variable STORAGE_BASE_DIRECTORY
...
Make sure you use the latest version of SAMDeployment
...
Bump up the version number in the Configuration.conf file
...
Update Configuration.conf matching the corresponding parameters from your previous one.
...
Fill in any new configuration parameters.
...
run make images
...
run make run
...
make |
Docker (docker.io equivalent)
To install docker packages, please add the Docker repository to your configuration manager:
Code Block |
---|
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo |
Then, you can install docker with the following command:
Code Block |
---|
sudo dnf install -y docker-ce docker-ce-cli containerd.io |
Unlike Ubuntu/Debian systems, Docker needs to be started once manually to be set up:
Code Block |
---|
sudo systemctl enable --now docker |
Docker-compose
Docker-compose needs to be installed from the official site. Please execute the following commands:
Code Block |
---|
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose |
Pass
Pass’ official name is password-store. It seems like it used to be part of RedHat/CentOS standard repository, but not anymore. You can download the latest official version from this link.
To install it, simply run:
Code Block |
---|
tar xvf password-store-x.y.z.tar.xz
cd password-store-x.y.z
sudo make install |
Docker group
To be able to execute some Docker commands, the current user will need to be added to the Docker group. To do so, open file /etc/group and append the current username to the “docker” line:
Code Block |
---|
docker:x:<groupid>:<username> |
Note |
---|
<groupid> is already filled with a system defined value, do not edit it. Simple add your own <username> to the end of the line. |