-
Notifications
You must be signed in to change notification settings - Fork 5
Déploiement de 1Village sur un serveur AWS
David Robert-Ansart edited this page Sep 9, 2021
·
13 revisions
Installation de docker
> sudo yum update -y
> sudo amazon-linux-extras install docker
> sudo service docker start
> sudo usermod -a -G docker ec2-user
Lancement de 1Village
> aws configure ## to do one time only
> aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin <ECR_ID>.dkr.ecr.eu-west-3.amazonaws.com
> docker pull <ECR_ID>.dkr.ecr.eu-west-3.amazonaws.com/1village:latest
> docker tag <ECR_ID>.dkr.ecr.eu-west-3.amazonaws.com/1village:latest 1village
> vim 1village/.env ## Write env variables
> docker run -d -p 8000:5000 --env-file=1village/.env --name 1village 1village
On installe Apache :
> sudo yum install -y httpd
> sudo systemctl start httpd
On active le module suivant:
> sudo yum install -y mod_security
Puis on ajoute à Apache des virtual hosts pour héberger sur un même serveurs plusieurs sites :
> sudo mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled
> sudo vim /etc/httpd/conf/httpd.conf
Ajouter ces lignes à la fin du ficher httpd.conf :
# Load config files in the "/etc/httpd/sites-enabled" directory, if any.
IncludeOptional sites-enabled/*.conf
On ajoute le fichier de conf de 1village: vim /etc/httpd/sites-available/1v.parlemonde.org.conf
<VirtualHost *:80>
ServerName 1v.parlemonde.org
ServerAdmin [email protected]
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
ProxyRequests Off
ProxyPreserveHost On
Protocols h2 h2c http/1.1
H2Direct on
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
</VirtualHost>
On enable
le site et on redémarre le serveur Apache :
> sudo ln -s /etc/httpd/sites-available/1v.parlemonde.org.conf /etc/httpd/sites-enabled/1v.parlemonde.org.conf
> sudo systemctl restart httpd
> sudo wget -r --no-parent -A 'epel-release-*.rpm' https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
> sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
> sudo yum-config-manager --enable epel*
> sudo systemctl restart httpd
> sudo yum install -y certbot python2-certbot-apache
> sudo certbot --apache -d 1v.parlemonde.org
On ajoute un CronJob pour renouveler automatiquement les certificats SSL:
> sudo vim /etc/crontab
On ajoute la ligne:
39 1,13 * * * root certbot renew --no-self-upgrade
Et enfin:
> sudo systemctl restart crond