1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00

Merge pull request #25 from YunoHost-Apps/testing

Testing
This commit is contained in:
yalh76 2022-02-17 20:23:31 +01:00 committed by GitHub
commit 2cfdbc229f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 100 additions and 79 deletions

View file

@ -1,8 +1,8 @@
;; Test complet sans multisite ;; Test complet sans multisite
auto_remove=1 auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
version="12" version="14"
oca=0 oca=0
admin_password="testpassw0rD" admin_password="testpassw0rD"
lang="en_US" lang="en_US"
@ -17,24 +17,8 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
wrong_user=1 port_already_use=0
wrong_path=0 change_url=0
incorrect_path=0
corrupt_source=1
fail_download_source=1
port_already_use=1
final_path_already_use=1
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
Level 4=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email=ljf+libreerp_ynh@reflexlibre.net Email=ljf+libreerp_ynh@reflexlibre.net
Notification=down Notification=down

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/odoo/odoo/archive/206e0b71ac74147a989db60cddae801534b97bdc.tar.gz SOURCE_URL=https://github.com/odoo/odoo/archive/336c9aab3619abb5bfbeb07f87ae014facdefb0b.tar.gz
SOURCE_SUM=a6d8d28bb7f20ac88fd149c652d7e4ce0f35241e46e7a3a347265dae0d7535fe SOURCE_SUM=3d37bc31383bfad827c3fdbab4daa3914ad036fd70fe1f20925ed18d2b9e1f87
SOURCE_FILENAME=odoo-12.tar.gz SOURCE_FILENAME=odoo-12.tar.gz
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum

5
conf/14.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/odoo/odoo/archive/d8322e64c6d999ffc72093b2ef2db91532138c89.tar.gz
SOURCE_SUM=40cbbc93ab594f614499ccdd04922590c420bfadeaf2f889853a5d58073e5fef
SOURCE_FILENAME=odoo-14.tar.gz
SOURCE_FORMAT=tar.gz
SOURCE_SUM_PRG=sha256sum

View file

@ -1,16 +1,16 @@
[Unit] [Unit]
Description={{ app }} Description=__APP__
Requires=postgresql.service Requires=postgresql.service
After=network.target postgresql.service After=network.target postgresql.service
[Service] [Service]
Type=simple Type=simple
SyslogIdentifier={{ app }} SyslogIdentifier=__APP__
PermissionsStartOnly=true PermissionsStartOnly=true
User={{ app }} User=__APP__
Group={{ app }} Group=__APP__
Environment=PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin Environment=PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
ExecStart={{ bin_file }} --config {{ conf_file }} --logfile /var/log/{{ app }}.log ExecStart=__BIN_FILE__ --config __CONF_FILE__ --logfile /var/log/__APP__.log
Restart=always Restart=always
RestartSec=3 RestartSec=3
StandardOutput=journal+console StandardOutput=journal+console

View file

@ -1,4 +1,4 @@
SOURCE_URL=https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz SOURCE_URL=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
SOURCE_SUM=049b2cdec9a8254f0ef8ac273afaf54f7e25459a273e27189591edc7d7cf29db SOURCE_SUM=049b2cdec9a8254f0ef8ac273afaf54f7e25459a273e27189591edc7d7cf29db
SOURCE_FILE=wkhtmltox-0.12.4_linux-generic-amd64.tar.xz SOURCE_FILE=wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
SOURCE_FORMAT=tar.xz SOURCE_FORMAT=tar.xz

View file

@ -2,10 +2,15 @@ location / {
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
try_files $uri @{{ app }}; try_files $uri @__APP__;
} }
location @{{ app }} { location @__APP__ {
proxy_pass http://127.0.0.1:{{ port }}; proxy_pass http://127.0.0.1:__PORT__;
client_max_body_size 50M;
client_body_timeout 60m;
fastcgi_read_timeout 60m;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_buffers 16 64k; proxy_buffers 16 64k;
proxy_buffer_size 128k; proxy_buffer_size 128k;
@ -20,7 +25,7 @@ location @{{ app }} {
proxy_send_timeout 720s; proxy_send_timeout 720s;
} }
location /longpolling { location /longpolling {
proxy_pass http://127.0.0.1:{{ port_chat }}; proxy_pass http://127.0.0.1:__PORT_CHAT__;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
@ -34,7 +39,7 @@ location ~* /web/static/ {
proxy_cache_valid 200 90m; proxy_cache_valid 200 90m;
proxy_buffering on; proxy_buffering on;
expires 864000; expires 864000;
proxy_pass http://127.0.0.1:{{ port }}; proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;

5
conf/oca-12.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/OCA/OCB/archive/4df6b0b164c6f384fdb7df40e51e80780572273a.tar.gz
SOURCE_SUM=e064dcd121ca207cbfa18c5f5f63c394ee6a1ca03f9ebbd6b88e6a62dda6bca0
SOURCE_FILENAME=odoo-12.tar.gz
SOURCE_FORMAT=tar.gz
SOURCE_SUM_PRG=sha256sum

5
conf/oca-14.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/OCA/OCB/archive/b7dc86b530718c090ba26b8eea0154d1c50c05f2.tar.gz
SOURCE_SUM=d2ca8bbe913e90f1623c6f2375d4cd2c40d4ed4abb650e66f7691669cbab90fa
SOURCE_FILENAME=odoo-14.tar.gz
SOURCE_FORMAT=tar.gz
SOURCE_SUM_PRG=sha256sum

View file

@ -1,22 +1,18 @@
[options] [options]
; This is the password that allows database operations: ; This is the password that allows database operations:
without_demo = all without_demo = all
admin_passwd = {{ admin_password }} admin_passwd = __ADMIN_PASSWORD__
db_host = localhost db_host = localhost
db_port = 5432 db_port = 5432
db_user = {{ db_name }} db_user = __DB_NAME__
db_password = {{ db_pass }} db_password = __DB_PASS__
{% if preinstall == '1' %} __CONTENT__
dbfilter = ^{{ db_name }}$ __CONTENT2__
{% else %} __CONTENT3__
db_name = {{ db_name }} addons_path = __FINAL_PATH__/__APPNAME__/addons,__FINAL_PATH__/custom-addons
{% if app_version > 9 %}dbfilter = False{% endif %}
list_db = False
{% endif %}
addons_path = {{ final_path }}/{{ APPNAME }}/addons,{{ final_path }}/custom-addons
proxy_mode = true proxy_mode = true
logfile = /var/log/{{ app }}.log logfile = /var/log/__APP__.log
xmlrpc_interface = 127.0.0.1 xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1 netrpc_interface = 127.0.0.1
xmlrpc_port = {{ port }} xmlrpc_port = __PORT__
longpolling_port = {{ port_chat }} longpolling_port = __PORT_CHAT__

View file

@ -34,8 +34,8 @@
"example": "erp.domain.org" "example": "erp.domain.org"
}, { }, {
"name": "version", "name": "version",
"choices": ["8", "9", "10", "11", "12"], "choices": ["11", "12", "14"],
"default": "12", "default": "14",
"ask": { "ask": {
"en": "Choose the version you want", "en": "Choose the version you want",
"fr": "Choisissez la version désirée" "fr": "Choisissez la version désirée"

View file

@ -2,31 +2,35 @@
# Common variables # Common variables
# #
export APPNAME="libreerp" export appname="libreerp"
export FORKNAME="odoo" export FORKNAME="odoo"
DEPENDENCIES="curl postgresql xfonts-75dpi xfonts-base wkhtmltopdf node-less python3-dev gcc libldap2-dev libssl-dev libsasl2-dev python3-pip python3-dev python3-venv python3-wheel libxslt-dev libzip-dev python3-setuptools python-virtualenv python-wheel python-setuptools libjpeg-dev zlib1g-dev virtualenv libfreetype6-dev" DEPENDENCIES="curl postgresql xfonts-75dpi xfonts-base wkhtmltopdf node-less python3-dev gcc libldap2-dev libssl-dev libsasl2-dev python3-pip python3-dev python3-venv python3-wheel libxslt-dev libzip-dev python3-setuptools libjpeg-dev zlib1g-dev libfreetype6-dev libffi-dev libpq-dev"
function debranding() { function debranding() {
# Remove Odoo references to avoid trademark issue # Remove Odoo references to avoid trademark issue
if [ -d $final_path/$APPNAME/$FORKNAME ]; then if [ -d $final_path/$appname/$FORKNAME ]; then
python_app=$final_path/$APPNAME/$FORKNAME python_app=$final_path/$appname/$FORKNAME
else else
python_app=$final_path/$APPNAME/openerp python_app=$final_path/$appname/openerp
fi fi
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <a[^>]*>Odoo<\/a>//g' {} \; find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <a[^>]*>Odoo<\/a>//g' {} \;
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \; find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \;
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \; find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \;
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \; find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \;
sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml
sed -i 's/<a[^>]*>Documentation<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml sed -i 's/<a[^>]*>Documentation<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml
sed -i 's/<a[^>]*>Support<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml sed -i 's/<a[^>]*>Support<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml
cp ../conf/logo_type.png $python_app/addons/base/static/img/logo_white.png cp ../conf/logo_type.png $python_app/addons/base/static/img/logo_white.png
cp ../conf/favicon.ico $final_path/$APPNAME/addons/web/static/src/img/favicon.ico cp ../conf/favicon.ico $final_path/$appname/addons/web/static/src/img/favicon.ico
} }
function setup_files() { function setup_files() {
ynh_setup_source $final_path/$APPNAME $app_version if [[ $oca -eq 0 ]]; then
ynh_setup_source $final_path/$appname $app_version
else
ynh_setup_source $final_path/$appname "oca-$app_version"
fi
debranding debranding
mkdir -p $final_path/custom-addons mkdir -p $final_path/custom-addons
chown -R $app:$app $final_path chown -R $app:$app $final_path
@ -38,10 +42,10 @@ function setup_files() {
chown $app:$app $conf_file chown $app:$app $conf_file
# Autoinstall the LDAP auth module # Autoinstall the LDAP auth module
if ls $final_path/$APPNAME/$FORKNAME-bin > /dev/null ; then if ls $final_path/$appname/$FORKNAME-bin > /dev/null ; then
ynh_replace_string "^{$" "{'auto_install': True," ${final_path}/$APPNAME/addons/auth_ldap/__manifest__.py ynh_replace_string "^{$" "{'auto_install': True," ${final_path}/$appname/addons/auth_ldap/__manifest__.py
else else
ynh_replace_string "'auto_install': False" "'auto_install': True" ${final_path}/$APPNAME/addons/auth_ldap/__openerp__.py ynh_replace_string "'auto_install': False" "'auto_install': True" ${final_path}/$appname/addons/auth_ldap/__openerp__.py
fi fi
fi fi
@ -63,14 +67,14 @@ function install_dependencies() {
fi fi
fi fi
pushd $final_path pushd $final_path
if grep "python3" $final_path/$APPNAME/$FORKNAME-bin ; then if grep "python3" $final_path/$appname/$FORKNAME-bin ; then
python3 -m venv venv python3 -m venv venv
venv/bin/pip3 install wheel venv/bin/pip3 install wheel
venv/bin/pip3 install -r $APPNAME/requirements.txt venv/bin/pip3 install -r $appname/requirements.txt
else else
virtualenv venv virtualenv venv
venv/bin/pip install wheel venv/bin/pip install wheel
venv/bin/pip install -r $APPNAME/requirements.txt venv/bin/pip install -r $appname/requirements.txt
fi fi
popd popd
} }

View file

@ -32,11 +32,26 @@ ynh_sso_access () {
ynh_configure () { ynh_configure () {
local TEMPLATE=$1 local TEMPLATE=$1
local DEST=$2 local DEST=$2
content=""
content2=""
content3=""
if [[ $preinstall == '1' ]]
then
content="dbfilter = $db_name"
else
content="db_name = $db_name"
if [[ $app_version > 9 ]]
then
content2="dbfilter = False"
fi
content3="list_db = False"
fi
mkdir -p "$(dirname $DEST)" mkdir -p "$(dirname $DEST)"
if [ -f '../manifest.json' ] ; then if [ -f '../manifest.json' ] ; then
ynh_render_template "${YNH_CWD}/../conf/$TEMPLATE.j2" "$DEST" ynh_add_config "${YNH_CWD}/../conf/$TEMPLATE.j2" "$DEST"
else else
ynh_render_template "${YNH_CWD}/../settings/conf/$TEMPLATE.j2" "$DEST" ynh_add_config "${YNH_CWD}/../settings/conf/$TEMPLATE.j2" "$DEST"
fi fi
} }

View file

@ -14,7 +14,7 @@ final_path=$(ynh_app_setting_get "$app" final_path)
conf_file=$(ynh_app_setting_get "$app" conf_file) conf_file=$(ynh_app_setting_get "$app" conf_file)
# Backup sources & data # Backup sources & data
ynh_backup "${final_path}/$APPNAME" ynh_backup "${final_path}/$appname"
ynh_backup "${final_path}/custom-addons" ynh_backup "${final_path}/custom-addons"
ynh_backup "${final_path}/.local" ynh_backup "${final_path}/.local"

View file

@ -15,12 +15,12 @@ export app_version=$YNH_APP_ARG_VERSION
export is_public=0 export is_public=0
export final_path="/var/www/$app" export final_path="/var/www/$app"
export conf_file=/etc/$app/main.conf export conf_file=/etc/$app/main.conf
export bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME-bin" export bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME-bin"
if [ "$app_version" = "9" ]; then if [ "$app_version" = "9" ]; then
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py" bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME.py"
fi fi
if [ "$app_version" = "8" ]; then if [ "$app_version" = "8" ]; then
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py" bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME.py"
fi fi
export db_name=$(ynh_sanitize_dbid $app) export db_name=$(ynh_sanitize_dbid $app)
export port=$(ynh_find_port 8069) export port=$(ynh_find_port 8069)
@ -43,8 +43,9 @@ function setup_database() {
ynh_configure server.conf $conf_file ynh_configure server.conf $conf_file
chown $app:$app $conf_file chown $app:$app $conf_file
# Load translation # Load translation
#param=" --without-demo True --addons-path $final_path/$APPNAME/addons --db_user $app --db_password $db_pass --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app " #param=" --without-demo True --addons-path $final_path/$appname/addons --db_user $app --db_password $db_pass --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app "
param=" -c $conf_file -d $app " param=" -c $conf_file -d $app "
sudo -u $app $bin_file -c $conf_file --stop-after-init -i base -d $app
sudo -u $app $bin_file -c $conf_file --stop-after-init -i auth_ldap -d $app sudo -u $app $bin_file -c $conf_file --stop-after-init -i auth_ldap -d $app
sudo -u $app $bin_file -c $conf_file --stop-after-init --load-language $lang -d $app sudo -u $app $bin_file -c $conf_file --stop-after-init --load-language $lang -d $app
# Configure language, timezone and ldap # Configure language, timezone and ldap

View file

@ -19,13 +19,14 @@ export db_pass=$(ynh_app_setting_get $app psqlpwd)
export final_path=$(ynh_app_setting_get $app final_path) export final_path=$(ynh_app_setting_get $app final_path)
export conf_file=$(ynh_app_setting_get $app conf_file) export conf_file=$(ynh_app_setting_get $app conf_file)
export is_public=0 export is_public=0
export bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME-bin" export bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME-bin"
if [ "$app_version" = "9" ]; then if [ "$app_version" = "9" ]; then
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py" bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME.py"
fi fi
if [ "$app_version" = "8" ]; then if [ "$app_version" = "8" ]; then
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py" bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME.py"
fi fi
export preinstall=0
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED