-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for pip install of odoo and addons
- Loading branch information
1 parent
15d810c
commit c1f8496
Showing
31 changed files
with
558 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
|
||
- name: Generate sample requirements.txt file | ||
template: src=odoo-{{ odoo_version }}-pip-requirements.txt dest="/home/{{ odoo_user }}/requirements.txt" | ||
owner={{ odoo_user }} group={{ odoo_user }} mode=0600 | ||
|
||
- name: Install build dependencies | ||
apt: pkg={{ item }} | ||
state=installed | ||
update_cache={{ odoo_apt_update_cache }} | ||
cache_valid_time={{ odoo_apt_cache_valid_time }} | ||
with_items: "{{ odoo_pip_build_dependencies }}" | ||
|
||
- name: Prepare the Python virtual environment | ||
become: yes | ||
become_user: "{{ odoo_user }}" | ||
shell: "{{ odoo_pip_venv_cmd }}" | ||
args: | ||
creates: "{{ odoo_pip_venv_path }}" | ||
|
||
- name: Download the pip requirements file | ||
get_url: url="{{ odoo_pip_requirements_url }}" | ||
force=yes | ||
dest="/home/{{ odoo_user }}/requirements.txt" | ||
|
||
- name: Install Odoo dependencies (PyPi) | ||
pip: | ||
name: "{{ item }}" | ||
virtualenv: "{{ odoo_pip_venv_path }}" | ||
with_items: "{{ odoo_pip_dependencies }}" | ||
|
||
- name: Install Odoo from pip external requirements file | ||
pip: | ||
requirements: /home/{{ odoo_user }}/requirements.txt | ||
extra_args: --upgrade | ||
virtualenv: "{{ odoo_pip_venv_path }}" | ||
|
||
|
||
- import_tasks: config.yml | ||
tags: | ||
- odoo_config | ||
|
||
- name: Generate Odoo init script | ||
template: src=odoo-pip.init dest=/etc/init.d/{{ odoo_service }} | ||
owner=root group=root mode=0755 | ||
force={{ odoo_force_config and 'yes' or 'no' }} | ||
backup=yes | ||
notify: Restart Odoo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
https://github.com/odoo/odoo/archive/10.0.tar.gz#egg=odoo | ||
-e git+https://github.com/OCA/[email protected]#egg=odoo10_addon_date_range&subdirectory=setup/date_range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
https://github.com/odoo/odoo/archive/11.0.tar.gz#egg=odoo | ||
-e git+https://github.com/OCA/[email protected]#egg=odoo11_addon_date_range&subdirectory=setup/date_range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/odoo/odoo/archive/8.0.tar.gz#egg=odoo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/odoo/odoo/archive/9.0.tar.gz#egg=odoo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
### BEGIN INIT INFO | ||
# Provides: {{ odoo_service }} | ||
# Required-Start: $remote_fs $syslog | ||
# Required-Stop: $remote_fs $syslog | ||
# Should-Start: $network | ||
# Should-Stop: $network | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Start odoo daemon at boot time | ||
# Description: Enable service provided by daemon. | ||
### END INIT INFO | ||
## more info: http://wiki.debian.org/LSBInitScripts | ||
|
||
. /lib/lsb/init-functions | ||
|
||
PATH=/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin | ||
WORKDIR={{ odoo_workdir }} | ||
VIRTUALENV={{ odoo_pip_venv_path }} | ||
DAEMON={{ odoo_pip_odoo_bin_path }} | ||
NAME={{ odoo_service }} | ||
DESC={{ odoo_service }} | ||
LOGFILE={{ odoo_logdir }}/{{ odoo_service }}.log | ||
PIDFILE=/var/run/${NAME}.pid | ||
USER={{ odoo_user }} | ||
export LOGNAME=$USER | ||
{% if odoo_init_env %} | ||
# Custom environment variables | ||
{% for name, value in odoo_init_env.iteritems() %} | ||
export {{ name }}={{ value }} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
test -x $DAEMON || exit 0 | ||
set -e | ||
|
||
function _start() { | ||
. $VIRTUALENV/bin/activate | ||
# '--load' is used here as Odoo ignores the 'server_wide_modules' option | ||
# from the configuration file | ||
# Odoo: https://github.com/odoo/odoo/pull/13685 | ||
# OCB: https://github.com/OCA/OCB/pull/553 | ||
start-stop-daemon --chdir=${WORKDIR} --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --logfile $LOGFILE{{ odoo_config_server_wide_modules not in [False, 'None', ''] and ' --load=%s' % odoo_config_server_wide_modules or '' }} | ||
} | ||
|
||
function _stop() { | ||
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 3 | ||
rm -f $PIDFILE | ||
} | ||
|
||
function _status() { | ||
start-stop-daemon --status --quiet --pidfile $PIDFILE | ||
return $? | ||
} | ||
|
||
|
||
case "$1" in | ||
start) | ||
echo -n "Starting $DESC: " | ||
_start | ||
echo "ok" | ||
;; | ||
stop) | ||
echo -n "Stopping $DESC: " | ||
_stop | ||
echo "ok" | ||
;; | ||
restart|force-reload) | ||
echo -n "Restarting $DESC: " | ||
_stop | ||
sleep 1 | ||
_start | ||
echo "ok" | ||
;; | ||
status) | ||
echo -n "Status of $DESC: " | ||
_status && echo "running" || echo "stopped" | ||
;; | ||
*) | ||
N=/etc/init.d/$NAME | ||
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
|
||
- hosts: localhost | ||
become: yes | ||
roles: | ||
- ansible-odoo | ||
vars: | ||
odoo_install_type: pip | ||
odoo_service: odoo-pip | ||
environment: | ||
LC_ALL: en_US.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
- hosts: localhost | ||
become: yes | ||
roles: | ||
- ansible-odoo | ||
vars: | ||
odoo_install_type: pip | ||
odoo_service: odoo-pip | ||
odoo_init_env: | ||
CHANGED_TEST: 1 | ||
environment: | ||
LC_ALL: en_US.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.