update pipeline
This commit is contained in:
parent
44f04d5c41
commit
785e8d4e9e
3
.gitignore
vendored
3
.gitignore
vendored
@ -22,7 +22,7 @@ odoo/filestore
|
|||||||
odoo/addons/base/maintenance
|
odoo/addons/base/maintenance
|
||||||
# window installation config file
|
# window installation config file
|
||||||
/odoo.conf
|
/odoo.conf
|
||||||
|
/deployment/postgresql
|
||||||
# generated for windows installer?
|
# generated for windows installer?
|
||||||
install/win32/*.bat
|
install/win32/*.bat
|
||||||
install/win32/meta.py
|
install/win32/meta.py
|
||||||
@ -49,3 +49,4 @@ package.json
|
|||||||
/man/
|
/man/
|
||||||
/share/
|
/share/
|
||||||
/src/
|
/src/
|
||||||
|
deployment/postgresql/*
|
||||||
|
24
Jenkinsfile
vendored
24
Jenkinsfile
vendored
@ -1,15 +1,29 @@
|
|||||||
node('Node-Dev-100163') {
|
node('Node-Dev-100163') {
|
||||||
try {
|
try {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
|
echo 'Pulling...' + env.BRANCH_NAME
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
stage('Setup') {
|
stage('Build') {
|
||||||
sh 'make install'
|
steps{
|
||||||
|
sh 'make install'
|
||||||
|
}
|
||||||
|
steps{
|
||||||
|
sh 'make build-image'
|
||||||
|
}
|
||||||
|
steps{
|
||||||
|
sh 'make push-image'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Start Docker Container'){
|
||||||
|
steps{
|
||||||
|
sh 'make run-server-docker'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stage('Testing') {
|
stage('Testing') {
|
||||||
sh 'make gen_test_config'
|
steps{
|
||||||
sh 'make run_test'
|
sh 'make run_test_docker'
|
||||||
sh 'make clean_test'
|
}
|
||||||
}
|
}
|
||||||
currentBuild.result = "SUCCESS" // Set success status after all stages complete
|
currentBuild.result = "SUCCESS" // Set success status after all stages complete
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
58
Makefile
58
Makefile
@ -4,40 +4,46 @@ UID = $(shell id -u)
|
|||||||
GID = $(shell id -g)
|
GID = $(shell id -g)
|
||||||
PYTHON=python
|
PYTHON=python
|
||||||
DOCKERCMD=docker
|
DOCKERCMD=docker
|
||||||
|
DOCKER_COMPOSE_CMD=docker-compose
|
||||||
DOCKER_BUILD=$(DOCKERCMD) build
|
DOCKER_BUILD=$(DOCKERCMD) build
|
||||||
DOCKER_PUSH=$(DOCKERCMD) push
|
DOCKER_PUSH=$(DOCKERCMD) push
|
||||||
DOCKER_IMAGE=$(DOCKERCMD) image
|
DOCKER_IMAGE=$(DOCKERCMD) image
|
||||||
DEPLOY_PATH=${PWD}/deployment
|
DEPLOY_PATH=${PWD}/deployment
|
||||||
SETUP_PATH=${PWD}/setup
|
SETUP_PATH=${PWD}/setup
|
||||||
BRANCH := main
|
|
||||||
HASH := $(shell git rev-parse HEAD)
|
HASH := $(shell git rev-parse HEAD)
|
||||||
CONFIG=odoo.conf
|
CONFIG=odoo.conf
|
||||||
check_env:
|
ODOO_IMAGE=hub.nextzenos.com/nexterp/odoo
|
||||||
@if [ ! -d "$(PYENV_ROOT)/versions/${BRANCH}" ]; then \
|
CONTAINER_ID=odoo-${TAG}
|
||||||
echo "Creating virtualenv for ${BRANCH}"; \
|
TAG := main
|
||||||
pyenv virtualenv ${BRANCH}; \
|
|
||||||
else \
|
|
||||||
echo "Virtualenv for ${BRANCH} already exists"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
$(MAKE) check_env
|
|
||||||
pyenv activate ${BRANCH} &&\
|
|
||||||
export DEBIAN_FRONTEND=noninteractive && \
|
|
||||||
sudo apt -y update && \
|
sudo apt -y update && \
|
||||||
sudo apt install -y python3-full python3-pip libldap2-dev libpq-dev libsasl2-dev && \
|
sudo apt install -y python3-full python3-pip libldap2-dev libpq-dev libsasl2-dev
|
||||||
pip install -r requirements.txt
|
run_test_docker:
|
||||||
gen_test_config:
|
sudo docker exec -it ${CONTAINER_ID} odoo -i all_modules --log-level=test --test-enable -d testdb --stop-after-init --config=/etc/odoo/${CONFIG} --xmlrpc-port=8070
|
||||||
${PWD}/setup/init_conf.sh
|
run_test_local:
|
||||||
run_test:
|
odoo-bin -i all_modules --log-level=test --test-enable -d testdb --stop-after-init --config=${CONFIG}
|
||||||
${PYTHON} odoo-bin -i all_modules --log-level=test --test-enable -d testdb --stop-after-init --config=${CONFIG}
|
gen_config:
|
||||||
clean_test:
|
${PWD}/setup/init_config.sh ${ODOO_IMAGE} ${TAG} ${CONTAINER_ID}
|
||||||
${PWD}/setup/clean_up.sh
|
build-image: gen_config
|
||||||
gen_env:
|
DOCKER_BUILDKIT=1 ${DOCKER_BUILD} . --progress plain --tag ${ODOO_IMAGE}:${TAG}
|
||||||
${PWD}/setup/init_env.sh
|
|
||||||
build-image: gen_env
|
|
||||||
DOCKER_BUILDKIT=1 ${DOCKER_BUILD} . --progress plain --tag ${ODOO_IMAGE}
|
|
||||||
push-image:
|
push-image:
|
||||||
$(DOCKERPUSH) ${ODOO_IMAGE}
|
$(DOCKER_PUSH) ${ODOO_IMAGE}:${TAG}
|
||||||
run-server:
|
run-server-local:
|
||||||
${PYTHON} odoo-bin --config=${CONFIG}
|
${PYTHON} odoo-bin --config=${CONFIG}
|
||||||
|
run-server-docker:
|
||||||
|
@if ! docker ps | grep -q "${CONTAINER_ID}"; then \
|
||||||
|
echo "Container not found. Running docker-compose up -d"; \
|
||||||
|
else \
|
||||||
|
echo "Container already running. Skipping docker-compose up -d."; \
|
||||||
|
fi
|
||||||
|
cd ${DEPLOY_PATH} &&\
|
||||||
|
${DOCKER_COMPOSE_CMD} up -d
|
||||||
|
clean_up:
|
||||||
|
@if ! docker ps | grep -q "${CONTAINER_ID}"; then \
|
||||||
|
echo "Container not found. Skipping"; \
|
||||||
|
else \
|
||||||
|
cd ${DEPLOY_PATH} &&\
|
||||||
|
${DOCKER_COMPOSE_CMD} down
|
||||||
|
fi
|
||||||
|
sudo rm -rf ${DEPLOY_PATH}/postgresql
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
services:
|
services:
|
||||||
odoo18:
|
app:
|
||||||
image: ${ODOO_IMAGE:-odoo:18}
|
image: ${ODOO_IMAGE:-odoo}:${ODOO_TAG:-18}
|
||||||
|
container_name: ${ODOO_CONTAINER:-odoo}
|
||||||
user: root
|
user: root
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
ports:
|
ports:
|
||||||
- "{ODOO_PORT:-8069}:8069"
|
- ${ODOO_PORT:-8069}:8069
|
||||||
# - "{ODOO_CHAT_PORT:-8072}:8072"
|
# - "${ODOO_CHAT_PORT:-8072}:8072"
|
||||||
tty: true
|
tty: true
|
||||||
command: --
|
command: --
|
||||||
environment:
|
environment:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
ODOO_IMAGE=
|
ODOO_IMAGE=
|
||||||
ODOO_TAG=
|
ODOO_TAG=
|
||||||
ODOO_PORT=10017
|
ODOO_PORT=10017
|
||||||
|
ODOO_CONTAINER=
|
||||||
# ODOO_CHAT_PORT=
|
# ODOO_CHAT_PORT=
|
||||||
ODOO_ADDONS=./addons
|
ODOO_ADDONS=./addons
|
||||||
ODOO_CONFIG=./etc
|
ODOO_CONFIG=./etc
|
||||||
|
8
deployment/etc/odoo.conf
Normal file
8
deployment/etc/odoo.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[options]
|
||||||
|
addons_path = /mnt/extra-addons
|
||||||
|
data_dir = /var/lib/odoo
|
||||||
|
db_host = db
|
||||||
|
db_port = 5432
|
||||||
|
db_user = nexterp
|
||||||
|
db_password = 2Gltp2kbNgEwpikRdyYaUNO2
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
[options]
|
|
||||||
addons_path = /mnt/extra-addons
|
|
||||||
data_dir = /var/lib/odoo
|
|
||||||
; admin_passwd = admin
|
|
||||||
; csv_internal_sep = ,
|
|
||||||
; db_maxconn = 64
|
|
||||||
; db_name = False
|
|
||||||
; db_template = template1
|
|
||||||
; dbfilter = .*
|
|
||||||
; debug_mode = False
|
|
||||||
; email_from = False
|
|
||||||
; limit_memory_hard = 2684354560
|
|
||||||
; limit_memory_soft = 2147483648
|
|
||||||
; limit_request = 8192
|
|
||||||
; limit_time_cpu = 60
|
|
||||||
; limit_time_real = 120
|
|
||||||
; list_db = True
|
|
||||||
; log_db = False
|
|
||||||
; log_handler = [':INFO']
|
|
||||||
; log_level = info
|
|
||||||
; logfile = None
|
|
||||||
; longpolling_port = 8072
|
|
||||||
; max_cron_threads = 2
|
|
||||||
; osv_memory_age_limit = 1.0
|
|
||||||
; osv_memory_count_limit = False
|
|
||||||
; smtp_password = False
|
|
||||||
; smtp_port = 25
|
|
||||||
; smtp_server = localhost
|
|
||||||
; smtp_ssl = False
|
|
||||||
; smtp_user = False
|
|
||||||
; workers = 0
|
|
||||||
; xmlrpc = True
|
|
||||||
; xmlrpc_interface =
|
|
||||||
; xmlrpc_port = 8069
|
|
||||||
; xmlrpcs = True
|
|
||||||
; xmlrpcs_interface =
|
|
||||||
; xmlrpcs_port = 8071
|
|
7
deployment/odoo.conf.template
Normal file
7
deployment/odoo.conf.template
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[options]
|
||||||
|
addons_path = /mnt/extra-addons
|
||||||
|
data_dir = /var/lib/odoo
|
||||||
|
db_host =
|
||||||
|
db_port =
|
||||||
|
db_user =
|
||||||
|
db_password =
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29
setup/color_log.py
Normal file
29
setup/color_log.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
def colorize(text, code):
|
||||||
|
"""Colorizes text using ANSI escape codes."""
|
||||||
|
return f"\033[{code}m{text}\033[0m"
|
||||||
|
|
||||||
|
def Show(status, message):
|
||||||
|
"""Displays a message with a status indicator."""
|
||||||
|
colors = {
|
||||||
|
0: (colorize("[", "90")+colorize(" OK ", "38;5;154") + colorize("]", "90")), # Green, Grey
|
||||||
|
1: (colorize("[", "90")+colorize(" FAILED ", "91") + colorize("]", "90")), # Red, Grey
|
||||||
|
2: (colorize("[", "90")+colorize(" INFO ", "38;5;154") + colorize("]", "90")), # Green, Grey
|
||||||
|
3: (colorize("[", "90")+colorize(" NOTICE ", "33") + colorize("]", "90")), # Yellow, Grey
|
||||||
|
}
|
||||||
|
print(f"{colors.get(status, '')} {message}")
|
||||||
|
if status == 1:
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
def Warn(message):
|
||||||
|
"""Displays a warning message in red."""
|
||||||
|
print(colorize(message, "91"))
|
||||||
|
|
||||||
|
def GreyStart():
|
||||||
|
"""Starts a grey-colored output."""
|
||||||
|
print(colorize("", "90"), end="")
|
||||||
|
|
||||||
|
def ColorReset():
|
||||||
|
"""Resets the output color."""
|
||||||
|
print("\033[0m", end="")
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
import configparser
|
import configparser
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
@ -7,7 +8,7 @@ from pathlib import Path
|
|||||||
import socket
|
import socket
|
||||||
import secrets
|
import secrets
|
||||||
import string
|
import string
|
||||||
|
import color_log
|
||||||
def generate_password(length=16):
|
def generate_password(length=16):
|
||||||
"""Generates a random password of specified length."""
|
"""Generates a random password of specified length."""
|
||||||
alphabet = string.ascii_letters + string.digits
|
alphabet = string.ascii_letters + string.digits
|
||||||
@ -19,9 +20,11 @@ def find_available_port(start_port=5432):
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
sock.bind(('localhost', start_port))
|
sock.bind(('localhost', start_port))
|
||||||
|
color_log.Show(3,f" {start_port} is Open")
|
||||||
return start_port
|
return start_port
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == 98: # Address already in use
|
if e.errno == 98: # Address already in use
|
||||||
|
print(f"{start_port} already in use , Try other port ...")
|
||||||
start_port += 1
|
start_port += 1
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
@ -31,31 +34,54 @@ def main():
|
|||||||
Generates a random password and finds an available port.
|
Generates a random password and finds an available port.
|
||||||
Updates the Odoo configuration file and .env file with these values.
|
Updates the Odoo configuration file and .env file with these values.
|
||||||
"""
|
"""
|
||||||
db_port = find_available_port()
|
parser = argparse.ArgumentParser(description="Generate Odoo configuration")
|
||||||
|
parser.add_argument('--db_port', type=int, help='')
|
||||||
|
parser.add_argument('--db_user', type=str, help='')
|
||||||
|
parser.add_argument('--deploy_path', type=str, help='')
|
||||||
|
parser.add_argument('--db', type=str, help='')
|
||||||
|
parser.add_argument('--image', type=str, help='')
|
||||||
|
parser.add_argument('--tag', type=str, help='')
|
||||||
|
parser.add_argument('--addons', type=str, help='')
|
||||||
|
parser.add_argument('--config', type=str, help='')
|
||||||
|
parser.add_argument('--container', type=str, help='')
|
||||||
|
args = parser.parse_args()
|
||||||
|
db_port = args.db_port
|
||||||
db_pass = generate_password(24)
|
db_pass = generate_password(24)
|
||||||
db_user = "nextzen"
|
db_user = args.db_user
|
||||||
print(f"Available port found: {db_port}")
|
base_dir= args.deploy_path
|
||||||
print(f"Database password generated: {db_pass}")
|
db_name=args.db
|
||||||
|
image=args.image
|
||||||
|
tag=args.tag
|
||||||
|
container=args.container
|
||||||
|
addons=args.addons
|
||||||
|
config_path=args.config
|
||||||
|
app_port = 10017
|
||||||
# Copy template files
|
# Copy template files
|
||||||
shutil.copyfile('odoo.conf.sample', 'odoo.conf')
|
shutil.copyfile(f'{base_dir}/odoo.conf.template', f'{base_dir}/etc/odoo.conf')
|
||||||
shutil.copyfile('testing_env/env.template', 'testing_env/.env')
|
shutil.copyfile(f'{base_dir}/env.template', f'{base_dir}/.env')
|
||||||
|
|
||||||
# Update Odoo configuration file
|
# Update Odoo configuration file
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('odoo.conf')
|
config.read(f'{base_dir}/etc/odoo.conf')
|
||||||
config['options']['db_host'] = "localhost"
|
config['options']['db_host'] = "db"
|
||||||
config['options']['db_user'] = db_user
|
config['options']['db_user'] = db_user
|
||||||
config['options']['db_password'] = db_pass
|
config['options']['db_password'] = db_pass
|
||||||
config['options']['db_port'] = str(db_port)
|
config['options']['db_port'] = str(db_port)
|
||||||
with open('odoo.conf', 'w') as configfile:
|
config['options']['addons_path'] = "/mnt/extra-addons"
|
||||||
|
config['options']['data_dir'] = "/var/lib/odoo"
|
||||||
|
with open(f'{base_dir}/etc/odoo.conf', 'w') as configfile:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
|
|
||||||
# Update .env file
|
# Update .env file
|
||||||
env_file_path = Path("testing_env/.env")
|
env_file_path = Path("deployment/.env")
|
||||||
set_key(dotenv_path=env_file_path, key_to_set="PG_USER", value_to_set=db_user)
|
set_key(dotenv_path=env_file_path, key_to_set="PG_DB", value_to_set=db_name,quote_mode="never")
|
||||||
set_key(dotenv_path=env_file_path, key_to_set="PG_PASS", value_to_set=db_pass)
|
set_key(dotenv_path=env_file_path, key_to_set="PG_USER", value_to_set=db_user,quote_mode="never")
|
||||||
set_key(dotenv_path=env_file_path, key_to_set="PG_PORT", value_to_set=str(db_port))
|
set_key(dotenv_path=env_file_path, key_to_set="PG_PASS", value_to_set=db_pass,quote_mode="never")
|
||||||
|
set_key(dotenv_path=env_file_path, key_to_set="ODOO_CONFIG", value_to_set=config_path,quote_mode="never")
|
||||||
|
set_key(dotenv_path=env_file_path, key_to_set="ODOO_ADDONS", value_to_set=addons,quote_mode="never")
|
||||||
|
set_key(dotenv_path=env_file_path, key_to_set="ODOO_PORT", value_to_set=find_available_port(app_port),quote_mode="never")
|
||||||
|
set_key(dotenv_path=env_file_path, key_to_set="ODOO_IMAGE", value_to_set=image,quote_mode="never")
|
||||||
|
set_key(dotenv_path=env_file_path, key_to_set="ODOO_TAG", value_to_set=tag,quote_mode="never")
|
||||||
|
set_key(dotenv_path=env_file_path, key_to_set="ODOO_CONTAINER", value_to_set=container,quote_mode="never")
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
export PATH=/usr/sbin:$PATH
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
((EUID)) && sudo_cmd="sudo" || sudo_cmd=""
|
|
||||||
readonly COLOUR_RESET='\e[0m'
|
|
||||||
readonly aCOLOUR=(
|
|
||||||
'\e[38;5;154m' # green | Lines, bullets and separators
|
|
||||||
'\e[1m' # Bold white | Main descriptions
|
|
||||||
'\e[90m' # Grey | Credits
|
|
||||||
'\e[91m' # Red | Update notifications Alert
|
|
||||||
'\e[33m' # Yellow | Emphasis
|
|
||||||
)
|
|
||||||
trap 'onCtrlC' INT
|
|
||||||
onCtrlC() {
|
|
||||||
echo -e "${COLOUR_RESET}"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Show() {
|
|
||||||
# OK
|
|
||||||
if (($1 == 0)); then
|
|
||||||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} OK $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
||||||
# FAILED
|
|
||||||
elif (($1 == 1)); then
|
|
||||||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[3]}FAILED$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
||||||
exit 1
|
|
||||||
# INFO
|
|
||||||
elif (($1 == 2)); then
|
|
||||||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} INFO $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
||||||
# NOTICE
|
|
||||||
elif (($1 == 3)); then
|
|
||||||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[4]}NOTICE$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
Warn() {
|
|
||||||
echo -e "${aCOLOUR[3]}$1$COLOUR_RESET"
|
|
||||||
}
|
|
||||||
|
|
||||||
GreyStart() {
|
|
||||||
echo -e "${aCOLOUR[2]}\c"
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorReset() {
|
|
||||||
echo -e "$COLOUR_RESET\c"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
generate_config() {
|
|
||||||
python setup/gen-config.py
|
|
||||||
echo "Generate Config Complete"
|
|
||||||
}
|
|
||||||
|
|
||||||
run_test_db() {
|
|
||||||
cd "$(pwd)/testing_env"
|
|
||||||
echo "Starting containers..."
|
|
||||||
docker-compose up -d
|
|
||||||
echo "Test Server is online"
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_config
|
|
||||||
run_test_db
|
|
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
export PATH=/usr/sbin:$PATH
|
export PATH=/usr/sbin:$PATH
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
ODOO_IMAGE='hub.nextzenos.com/nexterp/odoo'
|
|
||||||
DEPLOY_PATH=$(pwd)/deployment
|
DEPLOY_PATH=$(pwd)/deployment
|
||||||
|
SETUP_PATH=$(pwd)/setup
|
||||||
|
ODOO_IMAGE=$1
|
||||||
|
ODOO_TAG=$2
|
||||||
|
ODOO_CONTAINER=$3
|
||||||
PG_DB=nexterp
|
PG_DB=nexterp
|
||||||
PG_USER=nexterp
|
PG_USER=nexterp
|
||||||
CURRENT_BRANCH=main
|
|
||||||
ODOO_ADDONS=./addons
|
ODOO_ADDONS=./addons
|
||||||
ODOO_CONFIG=./etc
|
ODOO_CONFIG=./etc
|
||||||
# System
|
# System
|
||||||
@ -86,27 +87,13 @@ Check_OS() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
Generate_Env(){
|
Generate_Config(){
|
||||||
if [[ "$CURRENT_BRANCH" == "main" ]]; then
|
|
||||||
ODOO_TAG="latest"
|
|
||||||
else
|
|
||||||
ODOO_TAG="$CURRENT_BRANCH"
|
|
||||||
fi
|
|
||||||
if [[ ! -f "${DEPLOY_PATH}/.env" ]]; then
|
if [[ ! -f "${DEPLOY_PATH}/.env" ]]; then
|
||||||
cp "${DEPLOY_PATH}/env.template" "${DEPLOY_PATH}/.env"
|
cp "${DEPLOY_PATH}/env.template" "${DEPLOY_PATH}/.env"
|
||||||
fi
|
fi
|
||||||
|
python "$SETUP_PATH/gen-config.py" --db_port 5432 --db_user $PG_USER --deploy_path "$DEPLOY_PATH" \
|
||||||
sed -i \
|
--db ${PG_DB:=odoo} --image "${ODOO_IMAGE}" --container "${ODOO_CONTAINER}" --tag "${ODOO_TAG:=latest}" --addons "${ODOO_ADDONS}" --config "${ODOO_CONFIG}"
|
||||||
-e "s|^PG_DB=.*|PG_DB=${PG_DB:=odoo}|" \
|
Show 0 " Generate Config Complete"
|
||||||
-e "s|^PG_USER=.*|PG_USER=${PG_USER:=changeme}|" \
|
|
||||||
-e "s|^PG_PASS=.*|PG_PASS=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 24)|" \
|
|
||||||
-e "s|^ODOO_IMAGE=.*|ODOO_IMAGE=${ODOO_IMAGE}|" \
|
|
||||||
-e "s|^ODOO_TAG=.*|ODOO_TAG=${ODOO_TAG:=latest}|" \
|
|
||||||
-e "s|^ODOO_PORT=.*|ODOO_PORT=${ODOO_PORT:=10017}|" \
|
|
||||||
-e "s|^ODOO_ADDONS=.*|ODOO_ADDONS=${ODOO_ADDONS}|" \
|
|
||||||
-e "s|^ODOO_CONFIG=.*|ODOO_CONFIG=${ODOO_CONFIG}|" \
|
|
||||||
"${DEPLOY_PATH}/.env"
|
|
||||||
Show 0 "Generate env file complete"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Install_Depends() {
|
Install_Depends() {
|
||||||
@ -201,9 +188,9 @@ Check_Docker_Install_Final() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
Check_OS
|
# Check_OS
|
||||||
Update_Package_Resource
|
# Update_Package_Resource
|
||||||
Install_Depends
|
# Install_Depends
|
||||||
Check_Dependency_Installation
|
# Check_Dependency_Installation
|
||||||
Check_Docker_Install
|
# Check_Docker_Install
|
||||||
Generate_Env
|
Generate_Config
|
Loading…
Reference in New Issue
Block a user