EC2+RDS+Docker+Nginex+Odoo | eittech_
EC2+RDS+Docker+Nginex+Odoo
Como montar servicuis odoo en AWS

Crear Instancia en AWS y Instancia de BD en RDS

Making an Amazon EBS volume available for use on Linux

lsblk

FORMATEAR DISCO
sudo mkfs -t xfs /dev/xvdf

sudo mkdir /data

sudo mount /dev/xvdf /data

sudo blkid

sudo nano /etc/fstab

UUID=aebf131c-6957-451e-8d34-ec978d9581ae  /data  xfs  defaults,nofail  0  2



https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

Aprovisionar el Servidor (Ansible)


– name: Instala Docker y levanta los Contenedores necesarios
hosts: AWS
become: yes
vars:
ansible_user: ec2-user
ansible_ssh_private_key_file: ~/.ssh/eittech
remote_user: root
tasks:

– name: instala docker y modulos necesarios
yum:
pkg: [‘docker’]
# pkg: [‘docker’,’python3-pip’]
state: latest
update_cache: yes

– name: inicia servicio docker
service: name=docker state=started

– name: crea red nginx-proxy para docker
command: «docker network create nginx-proxy»

– name: ejecuta contenedor nginx-proxy
command: «docker run -d -p 80:80 –name nginx-proxy –net nginx-proxy -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy»

– name: Levanta el doo
command: «docker run –expose 80 –name odoo-megamercado –mount source=config,target=/etc/odoo –mount source=web-data,target=/var/lib/odoo –mount source=extra-addons,target=/mnt/extra-addons –net nginx-proxy -e VIRTUAL_PORT=8069 -e HOST=989.98.9898 -e PORT=5432 -e USER=user -e PASSWORD=’pass’ -e VIRTUAL_HOST=dominio.com,dominio2.com -t odoo:13.0 — –db-filter=’^%d'»

O Atraves de Comandos

sudo yum install docker -y
sudo systemctl start docker.service

Crear Network
sudo docker network create nginx-proxy

Levantar nginex
sudo docker run -d -p 80:80 –name nginx-proxy –net nginx-proxy -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy

Levantar odoo
sudo docker run –expose 80 –name odoo-megamercado –mount source=config,target=/etc/odoo –mount source=web-data,target=/var/lib/odoo –mount source=extra-addons,target=/mnt/extra-addons –net nginx-proxy -e VIRTUAL_PORT=8069 -e HOST=989.98.9898 -e PORT=5432 -e USER=user -e PASSWORD=’pass’ -e VIRTUAL_HOST=dominio.com,dominio2.com -t odoo:13.0 — –db-filter=’^%d’

Variable para filtrar por Base de Datos
–db-filter=’^%d’

VAriable para montar archivos fuera del volumen
–mount source=config,target=/etc/odoo

Fuentes:

https://blog.ssdnodes.com/blog/host-multiple-websites-docker-nginx/

Docker hub
https://hub.docker.com/_/odoo

ansible
https://www.udemy.com/course/ansible-essentials-simplicity-in-automation/learn/lecture/6125470#overview

en docs
Postgres
Comandos para Administrar