Commit 3df6be15 authored by Ndoumbe's avatar Ndoumbe
Browse files

first commit

parents
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+44 −0
Original line number Diff line number Diff line
FROM odoo:15

USER root

RUN apt update
### /install some development  tools 
RUN apt install -y unoconv vim git

### Install some dependencies needed by ijayo modules
# RUN pip install docxtpl
# RUN apt -y install libreoffice
# RUN pip install kafka-python

### Copy custume modules addons path 
COPY ./addons /mnt/extra-addons
COPY ./enterprise_addons /mnt/extra-addons

### Create  Script folder and change the owner recurcively  to odoo user 
RUN mkdir -p  /home/scripts \ 
    && chown -R odoo:odoo /home/scripts

### Copy Script folder
COPY ./scripts  /home/scripts

### Create data folder for persistant volume
RUN mkdir -p /home/data \
     && chown -R odoo:odoo /home/data

### Copy the edited entrypoint 
COPY ./entrypoint.sh  /

### Copy the edited odoo.conf
COPY ./config/odoo.conf /etc/odoo/  

### Edit permision on entrypoint.sh
RUN chown odoo /entrypoint.sh \
    && chmod 777 /entrypoint.sh

### Edit permision on odoo.conf
RUN chown odoo /etc/odoo/odoo.conf 

### Change user to odoo 
USER odoo
 No newline at end of file

Jenkinsfile

0 → 100644
+92 −0
Original line number Diff line number Diff line
#!/usr/bin/env groovy
def COLOR_MAP = [
	'SUCCESS': 'good',
	'FAILURE': 'danger',
]

pipeline {
	// Setting up local variables for the pipeline
	environment {
		// test variable: 0=success, 1=fail; must be string
		doError = '0'
		GIT_COMMIT_MSG = sh(returnStdout: true, script: "git log -1 --pretty=%B").trim()
	}

	agent any
	stages {
		stage('Checkout on tai') {
			steps {
                script {
                    last_stage = env.STAGE_NAME
                }
				ws("$WORKSPACE" + '/tai/') {
					git branch: 'master',
					credentialsId: 'gitlab_credential',
					url: 'http://gitlab.baamtu.com/diopbe/tai.git'
				}
			}
		}

        stage('test') {
           steps {
               script{
                echo'testing application'
               }
           }
        }

		stage('Prepare files for tai building') {
			steps {
                script {
                    last_stage = env.STAGE_NAME
                }
				ws("$WORKSPACE" + '/tai_build/') {
					sh 'cp -rf ../tai .'

					sh 'ls'
					sh 'rm -r tai/.git*'

					sh 'cp -rf tai/Dockerfile .'
					sh 'cp -rf tai/entrypoint.sh .'
					sh 'cp -rf tai/odoo.conf .'
					sh 'cp -rf tai/web_auth_oauth .'
					sh 'cp -rf tai/web_auth_signup .'
					sh 'cp -rf tai/web_portal .'
					sh 'ls'
				}
			}
		}

		stage('Building docker image for tai and pushing it') {
			steps {
                script {
                    last_stage = env.STAGE_NAME
                }
				ws("$WORKSPACE" + '/tai_build/') {
					script {
                        docker.withRegistry('', 'docker-hub-ndiop') {
                          def image = docker.build('baamtu/tai')
                          image.push()
                        }
					}
				}
			}
		}


	}

	// Post-build actions
	post {
		success {
			slackSend channel: 'tai',
			color: COLOR_MAP[currentBuild.currentResult],
			message: "*${currentBuild.currentResult}:* JOB ${env.JOB_NAME} | BUILD N° = ${env.BUILD_NUMBER}\n Plus d'infos: ${env.BUILD_URL} \n Une nouvelle image est disponible pour le projet TAI sur l'environnement MASTER\n Message du commit : ${env.GIT_COMMIT_MSG} \n Lien du commit: https://gitlab.baamtu.com/root/tai/commit/${env.GIT_COMMIT} "
		}
		failure {
			slackSend channel: 'tai',
			color: COLOR_MAP[currentBuild.currentResult],
			message: "*${currentBuild.currentResult}:* JOB ${env.JOB_NAME} | BUILD N° = ${env.BUILD_NUMBER} | Stage : " + last_stage + "\n Plus d'infos: ${env.BUILD_URL} \n Message du commit : ${env.GIT_COMMIT_MSG} \n Lien du commit: https://gitlab.baamtu.com/root/tai/commit/${env.GIT_COMMIT}"
		}
	}
}

config/odoo.conf

0 → 100644
+49 −0
Original line number Diff line number Diff line
[options]
addons_path = /mnt/extra-addons
data_dir = /home/data
admin_passwd = p.8at(k4ER\p:BYx*L
; csv_internal_sep = ,
; db_maxconn = 64
db_name = ijayo_crm
; db_template = template1
dbfilter = fongip

limit_memory_hard = 1677721600
limit_memory_soft = 629145600
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 3

; 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 = False
; log_db = False
; log_handler = [':INFO']
log_level = debug
; 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
; proxy_mode = True
 No newline at end of file

entrypoint.sh

0 → 100644
+49 −0
Original line number Diff line number Diff line
#!/bin/bash

set -e

if [ -v PASSWORD_FILE ]; then
    PASSWORD="$(< $PASSWORD_FILE)"
fi

# set the postgres database host, port, user and password according to the environment
# and pass them as arguments to the odoo process if not present in the config file for test 
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}

DB_ARGS=()
function check_config() {
    param="$1"
    value="$2"
    if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then       
        value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
    fi;
    DB_ARGS+=("--${param}")
    DB_ARGS+=("${value}")
}
check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

case "$1" in
    -- | odoo)
        shift
        if [[ "$1" == "scaffold" ]] ; then
            exec odoo "$@"
        else
            wait-for-psql.py ${DB_ARGS[@]} --timeout=30
            exec odoo "$@" "${DB_ARGS[@]}" -d fongip -u all -c /etc/odoo/odoo.conf
        fi
        ;;
    -*)
        wait-for-psql.py ${DB_ARGS[@]} --timeout=30
        exec odoo "$@" "${DB_ARGS[@]}" -d fongip -u all -c /etc/odoo/odoo.conf 
        ;;
    *)
        exec "$@"
esac

exit 1