Fix: Enviroment Live and Tests

This commit is contained in:
sinergia 2024-06-20 16:22:13 -05:00
parent b4999f9640
commit 049b1f697a
6 changed files with 119 additions and 21 deletions

View File

@ -7,24 +7,28 @@
[ ! -d "$SRC" ] && die "no se ubica ruta en SRC"
# dependencias minimas
pip3 install psycopg2 proteus==6.8.0 inotify honcho qrcode==6.1 pyshp==2.3.1 shapely==2.0.2 scipy==1.13.1 matplotlib==3.9.0
pip3 install git+https://rodia:3sh0r4d3s3gu1r@gitea.onecluster.org/OneTeam/oc-facho.git@MigrationPython312Test
pip3 install trytond-country==6.8.0\
trytond-company==6.8.0\
trytond-party==6.8.0 \
trytond-company==6.8.0\
trytond-currency==6.8.0\
trytond-account_product==6.8.0\
trytond-account_invoice_stock==6.8.0\
trytond-account_stock_continental==6.8.0\
trytond-account_statement==6.8.0\
trytond-bank==6.8.0\
trytond-product==6.8.0\
trytond-product_price_list==6.8.0\
trytond-purchase==6.8.0\
trytond-sale==6.8.0\
trytond-sale_price_list==6.8.0\
trytond-notification_email==6.8.0\
pip3 install psycopg2 proteus==${TRYTOND_VERSION} inotify honcho qrcode==6.1 pyshp==2.3.1 shapely==2.0.2 scipy==1.13.1 matplotlib==3.9.0
if [ "$FACHO" == "True" ]; then
pip3 install git+https://${GITEA_USER}:${GITEA_PASSWORD}@${GITEA_DOMAIN}/OneTeam/oc-facho.git@MigrationPython312Test
fi
pip3 install trytond-country==${TRYTOND_VERSION}\
trytond-company==${TRYTOND_VERSION}\
trytond-party==${TRYTOND_VERSION} \
trytond-company==${TRYTOND_VERSION}\
trytond-currency==${TRYTOND_VERSION}\
trytond-account_product==${TRYTOND_VERSION}\
trytond-account_invoice_stock==${TRYTOND_VERSION}\
trytond-account_stock_continental==${TRYTOND_VERSION}\
trytond-account_statement==${TRYTOND_VERSION}\
trytond-bank==${TRYTOND_VERSION}\
trytond-product==${TRYTOND_VERSION}\
trytond-product_price_list==${TRYTOND_VERSION}\
trytond-purchase==${TRYTOND_VERSION}\
trytond-sale==${TRYTOND_VERSION}\
trytond-sale_price_list==${TRYTOND_VERSION}\
trytond-notification_email==${TRYTOND_VERSION}\
module_names=()

View File

@ -1,7 +1,14 @@
# TOMADO DE: https://hg.tryton.org/tryton-docker/file/tip/6.6/Dockerfile
FROM node as builder-node
ENV SERIES 6.8
ARG TRYTOND_VERSION
ARG GITEA_USER
ARG GITEA_PASSWORD
ARG GITEA_DOMAIN
ARG FACHO
ARG FACHO_BRANCH
ENV SERIES=${TRYTOND_VERSION}
RUN npm install -g bower
RUN curl https://downloads.tryton.org/${SERIES}/tryton-sao-last.tgz | tar zxf - -C /
RUN cd /package && bower install --allow-root

View File

@ -1,5 +1,15 @@
# TOMADO DE: https://hg.tryton.org/tryton-docker/file/tip/6.6/Dockerfile
FROM python:3.11-bullseye
ARG TRYTOND_VERSION
ARG GITEA_USER
ARG GITEA_PASSWORD
ARG GITEA_DOMAIN
ARG FACHO
ARG FACHO_BRANCH
# trytond DB_CACHE requiere commandos `pg_dump` y `pg_restore`
RUN apt-get update && apt-get install -y postgresql-client
# Instalar psycopg2, flake8 y trytond
RUN pip install psycopg2 flake8 trytond==${TRYTOND_VERSION}

View File

@ -11,7 +11,6 @@ end
desc 'poblar entorno'
task :init => [:up] do
compose('exec', 'app.dev', 'pip3 install psycopg2 flake8 trytond==6.8.0')
compose('exec', 'app.dev', "bash .dev/install_module.sh")
end
@ -71,6 +70,66 @@ namespace :live do
end
desc 'produccion'
namespace :deploy do
desc 'iniciar entorno'
task :up do
compose('up', '--build', '-d', compose: 'docker-compose.yml')
end
desc 'monitorear salida'
task :tail do
compose('logs', compose: 'docker-compose.yml')
end
desc 'detener entorno'
task :down do
compose('down', compose: 'docker-compose.yml')
end
desc 'eliminar entorno'
task :del do
compose('down', '-v', '--rmi', 'all', compose: 'docker-compose.yml')
end
desc 'reiniciar entorno'
task :restart do
compose('restart', compose: 'docker-compose.yml')
end
desc 'terminal-tryton'
task :sh_tryton do
compose('exec', '--user', 'root', 'tryton', '/entrypoint.sh', 'bash', compose: 'docker-compose.yml')
end
desc 'terminal-worker'
task :sh_worker do
compose('exec', '--user', 'root', 'tryton_worker', '/entrypoint.sh', 'bash', compose: 'docker-compose.yml')
end
desc 'terminal-cron'
task :sh_cron do
compose('exec', '--user', 'root', 'tryton_cron', '/entrypoint.sh', 'bash', compose: 'docker-compose.yml')
end
desc 'terminal-db'
task :sh_db do
compose('exec', '--user', 'postgres', 'db', 'bash', compose: 'docker-compose.yml')
end
desc 'terminal-nginx'
task :sh_nginx do
compose('exec', 'nginx', 'bash', compose: 'docker-compose.yml')
end
desc 'top'
task :top do
compose('top', compose: 'docker-compose.yml')
end
end
def compose(*arg, compose: DOCKER_COMPOSE)
sh "docker-compose -f #{compose} #{arg.join(' ')}"
end

View File

@ -4,6 +4,13 @@ services:
build:
context: .
dockerfile: Dockerfile_Test
args:
TRYTOND_VERSION: ${TRYTOND_VERSION}
GITEA_USER: ${GITEA_USER}
GITEA_PASSWORD: ${GITEA_PASSWORD}
GITEA_DOMAIN: ${GITEA_DOMAIN}
FACHO: ${FACHO}
FACHO_BRANCH: ${FACHO_BRANCH}
environment:
SRC: /app
DB_CACHE: /tmp
@ -13,3 +20,5 @@ services:
volumes:
- .:/app
working_dir: /app
env_file:
- .env

View File

@ -9,6 +9,13 @@ services:
live.dev:
build:
context: .
args:
TRYTOND_VERSION: ${TRYTOND_VERSION}
GITEA_USER: ${GITEA_USER}
GITEA_PASSWORD: ${GITEA_PASSWORD}
GITEA_DOMAIN: ${GITEA_DOMAIN}
FACHO: ${FACHO}
FACHO_BRANCH: ${FACHO_BRANCH}
depends_on:
- db.dev
command: bash .dev/run.sh
@ -19,5 +26,7 @@ services:
volumes:
- .:/app
ports:
- "${TRYTON_PORT:-28000}:8000"
- "${TRYTON_PORT:-8000}:8000"
working_dir: /app
env_file:
- .env