123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- #!/bin/bash
- NET_NAME="eiru"
- ODOO_IMAGE="odoo/eiru:1.4"
- ODOO_PATH="/srv/odoo"
- DB_CONTAINER="database"
- DB_CONTAINER_PROXY="pgbouncer"
- ODOO_SYSTEMS="golden \
- athletic \
- topjeans \
- kava \
- amojeans \
- world \
- clasi_calse \
- tuspasos"
- start_database_system()
- {
- # start postgresql
- docker start $DB_CONTAINER
- # start pgbouncer
- docker run \
- --name $DB_CONTAINER_PROXY \
- --volume /srv/pgbouncer/config:/etc/pgbouncer \
- --volume /srv/pgbouncer/log:/var/log/pgbouncer \
- --net $NET_NAME \
- --ip 172.19.0.3 \
- --tty pgbouncer:alpine
- }
- start_odoo_system()
- {
- docker rm $1 -f
- docker run \
- --name $1 \
- --publish "$2:8069" \
- --volume "$ODOO_PATH/$1/conf:/etc/odoo" \
- --volume "$ODOO_PATH/$1/custom-addons:/mnt/extra-addons" \
- --volume "$ODOO_PATH/$1/files:/var/lib/odoo" \
- --link "$DB_CONTAINER:db" \
- --net $NET_NAME \
- --ip $3 \
- --tty $ODOO_IMAGE
- }
- start_odoo_systems()
- {
- start_odoo_system golden 10000 "172.19.0.100"
- start_odoo_system athletic 10500 "172.19.0.101"
- start_odoo_system topjeans 11000 "172.19.0.102"
- start_odoo_system kava 11500 "172.19.0.103"
- start_odoo_system amojeans 12500 "172.19.0.105"
- start_odoo_system world 13000 "172.19.0.106"
- start_odoo_system clasi_calse 13500 "172.19.0.107"
- start_odoo_system tuspasos 15000 "172.19.0.108"
- }
- start_monitor_systems()
- {
- docker start influxdb
- docker start telegraf
- docker start grafana
- docker start portainer
- }
- mount_backup_drives()
- {
- mount --type ext4 /dev/sdb /mnt/backup/primary_local_bkp
- mount --type ext4 /dev/sdc /mnt/backup/secondary_local_bkp
- }
- stop_odoo_systems()
- {
- for ODOO_NAME in $ODOO_SYSTEMS; do
- docker stop $ODOO_NAME
- done
- }
- stop_database_system()
- {
- docker stop pgbouncer
- docker rm pgbouncer -f
- docker stop database
- }
- stop_monitor_systems()
- {
- docker stop grafana
- docker stop telegraf
- docker stop influxdb
- }
- if [ ! -x "$(command -v docker)" ]; then
- echo "cannot bootup systems"
- exit 1
- fi
- if [ "$1" = "stop" ]; then
- stop_monitor_systems
- stop_odoo_systems
- stop_database_system
-
- exit 0
- fi
- start_database_system
- start_odoo_systems
- start_monitor_systems
- mount_backup_drives
- exit 0
|