Install

Ce document décrit le processus d'installation de l'IGCM.

Etapes

Pour installer l'IGCM il faut:

VM setup

Les VMs (test + prod) utilisent RHEL8. Suivre la procédure d'installation ci-dessous:

See https://computingforgeeks.com/install-docker-and-docker-compose-on-rhel-8-centos-8/ for details

Install docker:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache
sudo yum install docker-ce
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
sudo sh -c 'echo "exclude=docker-ce*" >> /etc/dnf/dnf.conf'

Note: need to logout and login again for groups to be taken into account. (i.e. docker commands without sudo)

Install docker-compose:

sudo yum -y install curl
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Register git public key in bitbucket and clone project:

ssh-keygen # optional (if no ssh key is present)
cat ~/.ssh/id_rsa.pub
...
git clone git@bitbucket.org:vpazeller/mhnn-collections.git
cd mhnn-collections
git config pull.ff only
git checkout -b test origin/test # for prod use the prod branch

Install rsync (medias sync):

sudo yum -y install rsync

Build and install the project + ssl certificates:

echo "export STACK=prod" >> ~/.bashrc # use the prod stack for test and prod VMs. This should be saved in profile for persistence.
echo "export POSTGRES_USER=mhnn-test" >> ~/.bashrc # it's good to differentiate users per stack to avoid accidents
echo "export POSTGRES_PASSWORD=my_password" >> ~/.bashrc # better: do it with vim
echo "export MH_FTP_MEDIA_ROOT=/" >> ~/.bashrc # use "test/" for the test stack

source ~/.bashrc
make build-test # build-prod for production build
# don't forget to choose the correct db port, usernames and passwords!
make install
sudo certbot certonly -d collection-test.museum-neuchatel.ch -a webroot --webroot-path /home/vincent/mhnn-collections/web/
docker container restart mhnn-collections_web_1
# add a cron task (everyday at 03h05) to renew the certificate and restart the web container
echo "05 03 * * * root certbot renew --quiet --post-hook \"/usr/bin/docker container restart mhnn-collections_web_1\""| sudo crontab -

Install the application

make ssh-web
./scripts/loadData # advice: uncomment parts of the script and load data step by step