Skip to content

Commit

Permalink
Add code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusAhlfors committed Apr 4, 2024
1 parent b3da1c7 commit 5e5254c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ RUN chown odoo:odoo /home/odoo/runonce-odoo.sh
COPY odoo-sudoers /etc/sudoers.d/odoo-sudoers
COPY odooctl /usr/local/bin/odooctl

# Install code server
RUN curl -fsSL https://code-server.dev/install.sh | sh
COPY diploi-vscode-settings.json /usr/local/etc/diploi-vscode-settings.json

# Copy a version of home so we can copy it in the mounted development version
RUN tar cvf /root/initial-odoo-home.tar /home/odoo

Expand Down
8 changes: 8 additions & 0 deletions diploi-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ hosts:
identifier: app
urlFormat: '[label].[default-domain]'

editors:
- name: App
identifier: app
service: app
port: 3001
stages:
- development

ssh:
- usernameFormat: '[label]'
contexts: label=app
Expand Down
4 changes: 4 additions & 0 deletions diploi-vscode-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"workbench.colorTheme": "Default Dark Modern",
"workbench.startupEditor": "none"
}
6 changes: 6 additions & 0 deletions runonce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ if [ ! -d "/var/lib/odoo/etc-odoo" ]; then
mv /etc/odoo/odoo-modified.conf /etc/odoo/odoo.conf;
chown odoo:odoo /etc/odoo/odoo.conf /var/lib/odoo/etc-odoo
cat /etc/odoo/odoo.conf | grep "passwd";

# Configure VSCode
mkdir -p /root/.local/share/code-server/User
cp /usr/local/etc/diploi-vscode-settings.json /root/.local/share/code-server/User/settings.json

fi

touch /var/log/git-credential-helper.log
Expand All @@ -42,6 +47,7 @@ su -s /home/odoo/runonce-odoo.sh -g odoo odoo
echo "Start odoo";
supervisorctl start odoo
supervisorctl start status
supervisorctl start code-server

echo "Runonce done";

Expand Down
11 changes: 11 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ stopasgroup=true
killasgroup=true
stdout_logfile=/var/log/status.log
stderr_logfile=/var/log/status.log

[program:code-server]
directory=/mnt/extra-addons
command=code-server --app-name Diploi --disable-getting-started-override --disable-workspace-trust --disable-update-check --disable-telemetry --auth none --bind-addr 0.0.0.0:3001 /mnt/extra-addons
user=odoo
autostart=false
autorestart=true
stopasgroup=true
killasgroup=true
stdout_logfile=/var/log/code-server.log
stderr_logfile=/var/log/code-server.log
2 changes: 2 additions & 0 deletions templates/odoo-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ spec:
name: app
- port: 3000
name: status
- port: 3001
name: editor
selector:
app: app
1 change: 1 addition & 0 deletions templates/odoo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
ports:
- containerPort: 8069
- containerPort: 3000
- containerPort: 3001
#readinessProbe:
# exec:
# command:
Expand Down

0 comments on commit 5e5254c

Please sign in to comment.