-
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 8, 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 369758534942.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
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