Skip to content

Commit

Permalink
[IMP] cetmix_tower_template_odoo: update Init Tower on server flightp…
Browse files Browse the repository at this point in the history
…lan with Add user to docker group command
  • Loading branch information
Aldeigja authored and CetmixGitBot committed Oct 1, 2024
1 parent c9246a4 commit 674f7c9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 44 deletions.
11 changes: 11 additions & 0 deletions cetmix_tower_template_odoo/data/cx_tower_command_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,15 @@
<field name="name">Stop shared PG</field>
<field name="code">docker rm {{ shared_postgres_name }}</field>
</record>

<record id="command_add_user_to_docker_group" model="cx.tower.command">
<field name="name">Add user to docker group</field>
<field
name="note"
>Adds current user to "docker" group to allow running Docker commands without 'sudo'</field>
<field name="code">usermod -a -G docker $USER</field>
</record>



</odoo>
68 changes: 26 additions & 42 deletions cetmix_tower_template_odoo/data/cx_tower_file_template_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,52 @@
Ensure git-aggregator.yml file is present.</field>

<field name="code">

FROM odoo:{{ odoo_version }}

ARG ODOO_BRANCH={{ odoo_version }}
ARG GITHUB_TOKEN= &lt;token&gt;
ARG GITHUB_TOKEN=&lt;token&gt;
ARG ODOO_ADDONS_TMP_LOCATION=/tmp/odoo-addons
ARG ODOO_ADDONS_LOCATION=/opt/odoo/extra-addons

USER root

# Install git
RUN DEBIAN_FRONTEND=noninteractive apt update &amp;&amp; \
apt-get install -qy --no-install-recommends \
git build-essential python3-pip python3-dev libffi-dev libssl-dev libsasl2-dev
libxslt1-dev libldap2-dev libcups2 pkg-config xmlsec1 libxmlsec1 libxmlsec1-dev
apt-get install -qy --no-install-recommends \
git build-essential python3-pip python3-dev libffi-dev libssl-dev libsasl2-dev libxslt1-dev libldap2-dev libcups2 pkg-config libxmlsec1 libxmlsec1-dev

# Configure git
RUN git config --global user.email {{ git_config_user_email }} &amp;&amp; git config
--global user.name {{ git_config_user_name }}
RUN git config --global user.email {{ git_config_user_email }} &amp;&amp; git config --global user.name {{ git_config_user_name }}

WORKDIR ${ODOO_ADDONS_TMP_LOCATION}

# Install git-aggregator and tools for requirements generation
RUN pip3 install --upgrade pip &amp;&amp; pip install manifestoo setuptools-odoo
git-aggregator
RUN pip3 install --upgrade pip &amp;&amp; pip install manifestoo setuptools-odoo git-aggregator --ignore-installed PyYAML

# Copy git-aggregator.yml
COPY ./git-aggregator.yml ${ODOO_ADDONS_TMP_LOCATION}

# Run git-affregator
RUN gitaggregate -c git-aggregator.yml --expand-env
RUN gitaggregate -c git-aggregator.yml --expand-env

# Make default
RUN find . -type d -maxdepth 2 -exec setuptools-odoo-make-default --addons-dir={}
--odoo-version-override=${ODOO_BRANCH} \;
RUN find . -type d -maxdepth 2 -exec setuptools-odoo-make-default --addons-dir={} --odoo-version-override=${ODOO_BRANCH} \;

# Build requirements
RUN find . -type d -maxdepth 2 -exec setuptools-odoo-get-requirements --addons-dir={}
--output={}/requirements.txt \;
RUN find . -type d -maxdepth 2 -exec setuptools-odoo-get-requirements --addons-dir={} --output={}/requirements.txt \;

# Merge all requirements into a single file
RUN find ./ -mindepth 0 -name requirements.txt -exec cat {} &gt; all_requirements.txt +
RUN find ./ -mindepth 0 -name requirements.txt -exec cat {} &gt; all_requirements.txt +

# Move all modules to the final destination
RUN mkdir -p ${ODOO_ADDONS_LOCATION} &amp;&amp; \
find . -mindepth 2 -maxdepth 2 -type d -not \( -name '.*' -o -name 'setup' \) -exec cp
-r {} ${ODOO_ADDONS_LOCATION} \; \
&amp;&amp; ls -lah ${ODOO_ADDONS_LOCATION} \
&amp;&amp; chown -R odoo ${ODOO_ADDONS_LOCATION}
find . -mindepth 2 -maxdepth 2 -type d -not \( -name '.*' -o -name 'setup' \) -exec cp -r {} ${ODOO_ADDONS_LOCATION} \; \
&amp;&amp; ls -lah ${ODOO_ADDONS_LOCATION} \
&amp;&amp; chown -R odoo ${ODOO_ADDONS_LOCATION}


# Install requirements
RUN find ./ -mindepth 0 -name requirements.txt -exec cat {} &gt; all_requirements.txt +
\
RUN find ./ -mindepth 0 -name requirements.txt -exec cat {} &gt; all_requirements.txt + \
&amp;&amp; pip3 install -r all_requirements.txt

# Remove tmp location
Expand All @@ -88,10 +80,9 @@
<field name="server_dir">{{ odoo_config_location }}</field>

<field name="code">
[options]
addons_path =
/opt/odoo/extra-addons
admin_passwd = {{ odoo_db_manager_password }}
[options]
addons_path = /opt/odoo/extra-addons
admin_passwd = {{ odoo_db_manager_password }}

</field>

Expand All @@ -110,23 +101,16 @@
IMPORTANT: ensure that Git Aggregator directories are not overwritten by the direct Git cloned ones</field>

<field name="code">
./project:
remotes:
remote_1: https://${GITHUB_TOKEN}:x-oauth-basic@github.com/oca/project.git
remote_2: https://${GITHUB_TOKEN}:x-oauth-basic@github.com/cetmix/oca-project.git
remote_3: https://${GITHUB_TOKEN}:x-oauth-basic@github.com/coopiteasy/project.git
merges:
-
remote: remote_1
ref: "16.0"
-
remote: remote_2
ref: refs/pull/105/head
-
remote: remote_3
ref: "16.0-mig-project_task_code-roke"
target: remote_1 16.0

<![CDATA[
./project:
remotes:
remote_1: https://github.com/OCA/project.git
merges:
-
remote: remote_1
ref: "16.0"
target: remote_1 16.0
]]>
</field>

</record>
Expand Down
13 changes: 11 additions & 2 deletions cetmix_tower_template_odoo/data/cx_tower_flight_plan_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,23 @@
<record id="plan_init_tower_line_7" model="cx.tower.plan.line">
<field name="sequence">17</field>
<field name="plan_id" ref="plan_init_tower" />
<field name="command_id" ref="command_create_shared_pg_directories" />
<field name="use_sudo">0</field>
<field name="command_id" ref="command_add_user_to_docker_group" />
<field name="use_sudo">1</field>

</record>

<!-- Line -->
<record id="plan_init_tower_line_8" model="cx.tower.plan.line">
<field name="sequence">18</field>
<field name="plan_id" ref="plan_init_tower" />
<field name="command_id" ref="command_create_shared_pg_directories" />
<field name="use_sudo">0</field>

</record>
<!-- Line -->
<record id="plan_init_tower_line_9" model="cx.tower.plan.line">
<field name="sequence">19</field>
<field name="plan_id" ref="plan_init_tower" />
<field name="command_id" ref="command_run_shared_pg" />
<field name="use_sudo">1</field>

Expand Down

0 comments on commit 674f7c9

Please sign in to comment.