Creando scripts de deployment del sistema.
This commit is contained in:
parent
a3a2165f43
commit
25e52a9e25
4 changed files with 186 additions and 148 deletions
79
deployer.sh
79
deployer.sh
|
|
@ -1,28 +1,83 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
|
||||
|
||||
https://www.phusionpassenger.com/library/deploy/nginx/automating_app_updates/python/
|
||||
set -x
|
||||
|
||||
### Variables de entorno ###
|
||||
DB_PATH=drogon_db
|
||||
DB_SERVICE_NAME=tst_drogon_db
|
||||
NETWORK_NAME=tst_drogon_network
|
||||
|
||||
|
||||
###############################################################
|
||||
################# INSTALACION DE HERRAMIENTAS #################
|
||||
###############################################################
|
||||
|
||||
apt-get update
|
||||
|
||||
### Set up de PIP ###
|
||||
if ! [ -x "$(pip -v git)" ]; then
|
||||
sudo apt-get -y install python3-pip
|
||||
if ! [ -x "$(command -v pip)" ]; then
|
||||
apt-get -y install python3-pip
|
||||
fi
|
||||
|
||||
|
||||
|
||||
### Set up de Docker ###
|
||||
if ! [ -x "$(command -v docker)" ]; then
|
||||
apt-get install apt-transport-https ca-certificates curl software-properties-common
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
apt-get update
|
||||
apt-get install docker-ce=18.06.0~ce~3-0~ubuntu
|
||||
fi
|
||||
|
||||
### Set up de GIT ###
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
apt-get install git-core
|
||||
fi
|
||||
|
||||
###############################################################
|
||||
################# DESPLIEGUE DE CODIGO ########################
|
||||
###############################################################
|
||||
|
||||
# Hacer clone desde remote
|
||||
git clone git@gitlab.com:pablomartincalvo/Drogon.git /opt/Drogon
|
||||
cd /opt/Drogon
|
||||
git checkout testing
|
||||
|
||||
|
||||
################# DB
|
||||
cd db_layer
|
||||
|
||||
# Build image
|
||||
docker build . -t drogon/img_${DB_SERVICE_NAME}:latest
|
||||
|
||||
# Crear volumen
|
||||
docker volume create vol_${DB_SERVICE_NAME}
|
||||
|
||||
# Crear red
|
||||
docker network create net_${NETWORK_NAME}
|
||||
|
||||
# Levantar maquina de DB
|
||||
docker run -d -v vol_${DB_SERVICE_NAME}:/var/lib/mysql \
|
||||
-p 3306:3306 \
|
||||
--name $DB_SERVICE_NAME \
|
||||
-e MYSQL_ROOT_PASSWORD=noesfacilvivirsindrogon \
|
||||
--network=net_${NETWORK_NAME} \
|
||||
drogon/img_${DB_SERVICE_NAME}:latest
|
||||
|
||||
# Respiro
|
||||
sleep 10s
|
||||
|
||||
|
||||
################# Servicios
|
||||
|
||||
# Instalar requerirements
|
||||
cd ..
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
#Explorer
|
||||
|
||||
#Refresher
|
||||
|
||||
#Capturer
|
||||
|
||||
#Geocoder
|
||||
|
||||
|
||||
### Set up de GIT ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue