-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Domatix/dev
First version
- Loading branch information
Showing
13 changed files
with
654 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
containers/ | ||
repos/*.sh | ||
.idea/ |
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,14 @@ | ||
ifeq ($(PREFIX),) | ||
PREFIX := /usr/bin | ||
endif | ||
|
||
current_dir = $(shell pwd) | ||
install: | ||
ln -s ${current_dir}/run.sh ${PREFIX}/cnt | ||
|
||
|
||
update_conf: $(current_dir)/containers/* | ||
for file in $^; do \ | ||
cp ${current_dir}/helper-scripts/* $${file}/custom ; \ | ||
done | ||
|
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,42 @@ | ||
# Odoo development manager | ||
pure bash docker-compose frontend for managing Odoo development instances | ||
|
||
|
||
## preface | ||
- this will install an executable in `/usr/bin/` called `cnt`; before installing check that it doesn't conflict with your system configuration. regarding docker, | ||
a `domatix/odoo:base` image will be installed; you also need to check that this does not conflict with your current system configuration. | ||
|
||
- this document explains the basic installation and update steps. if you want to know the script's ins and outs, check the development [documentation](https://github.com/Domatix/odm/wiki) | ||
|
||
|
||
## install | ||
### dependencies | ||
- gnu make | ||
- docker | ||
- docker-compose | ||
- expect | ||
|
||
### installation | ||
|
||
```bash | ||
git clone https://gitlab.domatix.com/catalin/odoo-dev | ||
cd odoo-dev | ||
sudo make install # this will create the cnt executable | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
## update | ||
|
||
if you updated the script from upstream, chances are that the utilities your containers have are not updated | ||
|
||
```bash | ||
cd your-odoo-dev-root-path | ||
make update_conf | ||
``` | ||
if you only want to update a specific container: | ||
```bash | ||
cp helper-scripts/* containers/<your-odoo-container>/custom/ | ||
``` |
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,14 @@ | ||
#!/usr/bin/env bash | ||
#### Written by: Catalin Airimitoaie - catalin@domatix.com | ||
#### Description: ODM build script. Do not call this script directly, it will be ran by `run.sh` in order to build a new development instance | ||
|
||
cd $1 | ||
if ! docker image ls | grep "domatix/odoo" | grep "base"; then | ||
docker build -t domatix/odoo:base ../../dockerfiles/base | ||
fi | ||
|
||
source .env | ||
docker-compose build --no-cache | ||
sudo chown -R $USER:$USER $etc_path/../ | ||
touch $etc_path/run.pid | ||
cp $( cd "$(dirname "$0")" ; pwd -P )/../../helper-scripts/* $etc_path |
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,17 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive. | ||
ENV LANG C.UTF-8 | ||
ENV TZ=Europe/Madrid | ||
RUN apt-get update -y | ||
RUN apt-get upgrade -y | ||
RUN apt-get install -y vim strace git python3-pip curl nano python3-all-dev python3-dev python3-setuptools libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl8.6-dev tk8.6-dev python-tk libyaml-dev fontconfig nodejs npm postgresql-client postgresql-contrib libxslt1-dev python3-pypdf2 build-essential python3-dev libxslt-dev libzip-dev libldap2-dev libsasl2-dev gdb | ||
RUN curl -o wkhtmltox.tar.xz -SL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \ | ||
&& echo '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum -c - \ | ||
&& tar xvf wkhtmltox.tar.xz \ | ||
&& cp wkhtmltox/lib/* /usr/local/lib/ \ | ||
&& cp wkhtmltox/bin/* /usr/local/bin/ \ | ||
&& cp -r wkhtmltox/share/man/man1 /usr/local/share/man/ | ||
RUN npm install -g less less-plugin-clean-css | ||
RUN pip3 install phonenumbers xmlsig workdays numpy | ||
|
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,14 @@ | ||
FROM domatix/odoo:base | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive. | ||
ENV LANG C.UTF-8 | ||
ENV TZ=Europe/Madrid | ||
ARG id | ||
ARG odoo_version | ||
RUN useradd -m -d /opt/odoo -u $id -s /bin/bash odoo | ||
RUN mkdir /opt/odoo/sources | ||
RUN git clone --depth=1 --branch=$odoo_version https://github.com/odoo/odoo.git /opt/odoo/sources/odoo | ||
RUN chown -R odoo:odoo /opt/odoo/sources/odoo | ||
RUN pip3 install -r /opt/odoo/sources/odoo/doc/requirements.txt | ||
RUN pip3 install -r /opt/odoo/sources/odoo/requirements.txt | ||
|
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,20 @@ | ||
#!/usr/bin/env bash | ||
#### Written by: Catalin Airimitoaie - catalin@domatix.com | ||
#### Description: Odoo config file auto-(re)generation. Do not call this script directly, it will be ran by `../run.sh`. | ||
|
||
cd ~/custom | ||
addons=$(cd addons; ls -l | awk '{print $9}') | ||
if [[ -f etc/odoo.tmp.conf ]]; | ||
then | ||
rm etc/odoo.tmp.conf | ||
fi | ||
|
||
cp etc/odoo.conf etc/odoo.tmp.conf | ||
for addon in $addons | ||
do | ||
if [[ ! -z "$addon" ]]; | ||
then | ||
echo -e " /opt/odoo/custom/addons/$addon," >> etc/odoo.tmp.conf | ||
fi | ||
done | ||
|
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,10 @@ | ||
#!/usr/bin/env bash | ||
#### Written by: Catalin Airimitoaie - catalin@domatix.com | ||
#### Description: Odoo execution script. Do not call this script directly, it will be ran by `../run.sh`. | ||
|
||
cd $HOME/custom | ||
echo $$ > etc/run.pid | ||
args="$@" | ||
command="~/sources/odoo/odoo-bin -c etc/odoo.tmp.conf --limit-time-real 99999 $args" | ||
exec ${command} | ||
|
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,39 @@ | ||
# repos clone scripts | ||
|
||
## how it works | ||
|
||
by calling `cnt -c [CONTAINER] [REPO] [BRANCH]` | ||
|
||
```bash | ||
cnt -c odoo12 repos 12.0 | ||
``` | ||
|
||
## how to create a repo script | ||
|
||
1. copy the template script | ||
|
||
```bash | ||
cp repos/repos.sh.template repo.sh | ||
``` | ||
|
||
2. open the new file and add your repos inside the `repos` list | ||
|
||
```bash | ||
|
||
# [...] | ||
|
||
|
||
# $BRANCH is optional if the desired branch is the repo default | ||
repos=( | ||
"https://my-git-url.com/repo.git -b $BRANCH" | ||
"https://my-git-url.com/repo.git -b $BRANCH" | ||
) | ||
``` | ||
|
||
if some of your repos are private, provide the http username and password inside the `crendentials` dict | ||
```bash | ||
declare -A crendetials=( | ||
["user"]="user" | ||
["password"]="pasword" | ||
) | ||
``` |
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,50 @@ | ||
#!/bin/bash | ||
#### Description: addons clone helper script | ||
|
||
wd="$1"/custom/addons | ||
BRANCH="$2" | ||
|
||
declare -a repos | ||
repos=( | ||
"https://my-git.com/repo.git -b $BRANCH" | ||
"https://my-git/repo2.git" | ||
"git@my-git/repo2.git" | ||
) | ||
|
||
|
||
|
||
declare -A credentials=( | ||
["user"]='' | ||
["password"]='' | ||
) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
for repo in "${repos[@]}" | ||
do | ||
|
||
expect <<- DONE | ||
spawn git -C $wd clone $repo | ||
expect "Username*:" | ||
send -- "${credentials['user']}\r" | ||
send -- "\r" | ||
expect "Password*:" | ||
send -- "${credentials['password']}\r" | ||
expect eof | ||
DONE | ||
done | ||
|
||
|
||
|
||
echo go to $wd to see your cloned repos | ||
|
||
|
||
|
Oops, something went wrong.