First Steps with ownerp.io - Visual Code based on OpenVSCode
28.01.2025
1.96.4 - Odoo 12-18
- 1.1 Login
- 1.1.1.1 VS Code
- 1.1.1.2 pgAdmin
- 1.1.1.3 FastReport
- 1.1.1.4 smtp
- 1.1.1.5 Odoo Run
- 1.1.2 Global settings
- 1.1.3 Access from shell
- 1.1.3.1 Before update manually
- 1.1.3.2 After update manually
- 1.1.4 Before update Docker compose
- 1.1.5 After update use
- 1.1.6 Update .zshrc
- 1.2 Python Version
- 1.2.1 Install Extensions:
- 1.1 Login
- 2 IMPORTANT DEBUGGING
- 3 Unique steps:
- 3.1 Connect gitlab & github and ownerp.io
- 3.1.1 git username / email
- 3.2 Pull dev-helpers
- 3.2.1 myodoo.sh branch pull
- 3.3 Do the Inital scripts
- 3.3.1 ownerp.io branch pull
- 3.3.2 pull servers
- 3.4 Installations:
- 3.1 Connect gitlab & github and ownerp.io
- 4 More steps / usage:
- 4.1 How to change the Python Interpreter?
- 4.2 How to add python libs to the venv?
- 4.3 Pull repositories/ update (was switch-to-develop before)
- 4.4 Database restore
- 4.4.1 cloud download
- 4.4.2 Cloud Download use
- 4.4.3 cd command
- 4.4.4 Use restore script alias
- 4.5 Start database / Odoo:
- 4.6 Kill all Python processes
- 4.7 Make your own Config files
- 4.8 Pull process
- 4.8.1 pull with shell
- 4.9 Commit & Push process
- 4.10 Open second terminal:
- 4.11 SQL queries over PG Admin in browser
- 4.12 Important Shell Shortcuts and tmux: Cheat Sheet für ownerp.io Shortcuts
Login
XX placeholder f.e. vs00…
VS Code
Open the URL https://vsXX.ownerp.io/?tkn=YourToken in a browser.
pgAdmin
Open the URL https://pgXX.ownerp.io in a browser.
FastReport
Open the URL https://frXX.ownerp.io in a browser.
smtp
Open the URL https://smtpXX.ownerp.io in a browser.
Odoo Run
Open the URL https://devXX.ownerp.io in a browser for Odoo Port 8069
Open the URL https://devXX-2.ownerp.io in a browser for Odoo Port 9069
(Credentials from Admin )
Global settings
Set some global settings
You can enhance the global settings of VS Code with these parameters.
{
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.renderWhitespace": "all",
"extensions.autoUpdate": false,
"editor.fontSize": 16,
"debug.console.fontSize": 16,
"terminal.integrated.sendKeybindingsToShell": true,
"terminal.integrated.fontSize": 16,
"git.enableSmartCommit": true,
"git.autoRepositoryDetection": "subFolders",
"git.autofetch": true,
"git.confirmSync": false,
"explorer.confirmDragAndDrop": false,
"python.defaultInterpreterPath": "/opt/venv/p3/bin/python3",
"editor.accessibilityPageSize": 13,
"workbench.startupEditor": "none",
"workbench.colorTheme": "Tomorrow Night Blue",
}
Access from shell
ver="0"
docker exec -ti dev-vs-$ver env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM /bin/zsh
Before update manually
mkdir -p /home/workspace/.ssh && yes | cp /home/openvscode-server/.ssh/* /home/workspace/.ssh
After update manually
mkdir -p /home/openvscode-server/.ssh && yes | cp /home/workspace/.ssh/* /home/openvscode-server/.ssh
Before update Docker compose
docker exec -ti dev-vs-$ver env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM /bin/zsh -c 'mkdir -p /home/workspace/.ssh && yes | cp /home/openvscode-server/.ssh/* /home/workspace/.ssh'
docker compose -p dev$ver -f docker-compose-dev$ver.yml down
docker pull dpage/pgadmin4:latest
mce docker-compose-dev$ver.yml
After update use
docker compose -p dev$ver -f docker-compose-dev$ver.yml up -d
docker exec -ti dev-vs-$ver env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM /bin/zsh -c 'mkdir -p /home/openvscode-server/.ssh && yes | cp /home/workspace/.ssh/* /home/openvscode-server/.ssh'
Update .zshrc
docker exec -ti dev-vs-$ver env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM /bin/zsh
cd /home/workspace/gitbase/ && \
rm -rf dev-helpers && \
git clone -b ownerp.io-2024 git@gitlab.ownerp.io:myodoo-tools/dev-helpers.git && \
/bin/bash /home/workspace/gitbase/dev-helpers/scripts/vs_post_update.sh
The Visual Studio Code screen appears in Browser.
Python Version
Use the latest Python Version in VSC.
Install Extensions:
Necessary: Python, Jupyter, Gitlens
Other Extensions & Themes can be installed optional.
IMPORTANT DEBUGGING
ONLY DEBUGGING POSSIBLE YOU SHOULD SET WORKER=0 IN ODOO.CONF
Unique steps:
Connect gitlab & github and ownerp.io
To connect the VM to Gitlab, generate the key as described in the article Cheat Sheet for VM Shell Shortcuts under Prepare git Access.
Then go to Gitlab and store the key in the profile under Settings > SSH Key.
With the same key you should also connect to your Github https://github.com/ account: go to your user top right > Settings> SSH & GPG Keys
New SSH Key entry:
A test Commit is recommended after add over terminal:
git username / email
git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"
git config --global credential.helper store
Pull dev-helpers
Repository: https://gitlab.ownerp.io/myodoo-tools/dev-helpers
Über Terminal in /home/workspace/gitbase navigieren.
myodoo.sh branch pull
cd /home/workspace/gitbase
git clone -b ownerp.io-2024 git@gitlab.ownerp.io:myodoo-tools/dev-helpers.git
Do the Inital scripts
Over the terminal navigate to /gitbase/dev-helpers/scripts/gitpull
ownerp.io branch pull
cd /home/workspace/gitbase/dev-helpers/scripts/gitpull
Odoo servers must be pulled separately for all versions: (https://gitlab.ownerp.io/myodoo-tools/dev-helpers/-/blob/ownerp.io-2023/scripts/gitpull/get-initial-gitlab-odoo-servers.py?ref_type=heads)
pull servers
python get-initial-gitlab-odoo-servers.py
Installations:
Installing over sudo possible. (Password in 1Password)
More steps / usage:
How to change the Python Interpreter?
[CRTL] + [SHIFT] + P
How to add python libs to the venv?
Edit and rerun the build script for the environment:
ll /opt/ownerp-installs
total 88K
drwxr-xr-x 1 root root 4.0K Nov 12 09:48 ./
drwxr-xr-x 1 root root 4.0K Nov 12 09:48 ../
-rwxrwxrwx 1 root root 638 Nov 11 17:59 create_virtualenv_python3_12_v16.sh*
-rwxrwxrwx 1 root root 591 Nov 11 17:59 create_virtualenv_python3_12_v17.sh*
-rwxrwxrwx 1 root root 638 Nov 11 17:59 create_virtualenv_python3_12_v18.sh*
-rwxrwxrwx 1 root root 578 Jun 26 15:17 create_virtualenv_python3.sh*
-rwxrwxrwx 1 root root 5.2K Sep 10 17:34 create_virtualenv_python3_v12.sh*
-rwxrwxrwx 1 root root 5.2K Sep 10 17:34 create_virtualenv_python3_v13.sh*
-rwxrwxrwx 1 root root 586 Jun 26 15:17 create_virtualenv_python3_v14.sh*
-rwxrwxrwx 1 root root 587 Jun 26 15:17 create_virtualenv_python3_v15.sh*
-rwxrwxrwx 1 root root 636 Jun 26 15:17 create_virtualenv_python3_v16.sh*
-rwxrwxrwx 1 root root 591 Jun 26 15:17 create_virtualenv_python3_v17.sh*
-rw-rw-rw- 1 root root 236 Jun 26 15:17 requirements_p3_11.txt
-rw-rw-rw- 1 root root 1.3K Sep 10 17:34 requirements_p3_11_v16.txt
-rw-rw-rw- 1 root root 1.3K Sep 10 17:34 requirements_p3_11_v17.txt
-rw-rw-rw- 1 root root 1.3K Jun 26 15:17 requirements_p3_12_v16.txt
-rw-rw-rw- 1 root root 1.3K Jun 26 15:17 requirements_p3_12_v17.txt
-rw-rw-rw- 1 root root 1.3K Nov 12 09:48 requirements_p3_12_v18.txt
-rw-rw-rw- 1 root root 1.1K Sep 10 17:34 requirements_p3_8_v14.txt
-rw-rw-rw- 1 root root 849 Jun 26 15:17 requirements_p3_8_v15.txt
╭─openvscode-server in ~ 22-04-14 - 10:06:19
╰─○ sudo nano /opt/ownerp-installs/create_virtualenv_python3.sh
╭─openvscode-server in ~ 22-04-14 - 10:07:11
╰─○ sudo /opt/ownerp-installs/create_virtualenv_python3.sh
Pull repositories/ update (was switch-to-develop before)
Navigate to the path you need e.g. /gitbase/v13 over File > Open Folder> Path
Click the Run and Debug symbol and click on Pull v13 Repositories (oder v10 oder v11 oder v12 oder v14)
Database restore
ZIP-files have to be in the uploads directory.
Variant 1 in terminal: wget - command e.g. from a Dropbox: wget https://www.dropbox.com/s/7xph0yoh3v0o2kn/v13_skr03_demo_2021-03-31.zip
or via Sharepoint (Onedrive) e.g.
wget https://cmcequitania-my.sharepoint.com/:u:/g/personal/j_eberle_equitania_de/ETdOASWLABKoBMLJAuwy2gBYO_6dZwTpVK9IwLeKvhHRQ?download=1 -O mydb.zip (add the download=1 and the -O part with you document file in the generated link) Only OneDrive oder Dropbox possible.
Variante 2 over Script: cloud-downloader-equitania > Hidrive/ Onedrive / Dropbox / Google Drive possible!
Install the script over pip install in your dev environment, you have to update the script of the env you want to use:
cloud download
cd /home/workspace/uploads
cloud-download
cloud-download --help shows options:
These can be added directly into the command:
Cloud Download use
cloud-download --deinlinkzumfile --output.zip
Navigate over the terminal in /gitbase/dev-helpers/scripts/ :
cd command
cd /home/workspace/gitbase/dev-helpers/scripts/
Execute Restore Zip:
Use restore script alias
restore-zip
The rest of the restore is like in guacamole VM.
IMPORTANT: when restoring always start with version abbreviation v12_ v13_ v14_ etc.
Start database / Odoo:
open Terminal
Change Odoo environment : e.g. dev16
Enter the command for starting a DB. (exam12 / exam13 / exam14 etc. )
E.g.
Start Odoo from shell
./odoo-bin -c /home/workspace/myconfs/odoo16.conf --db-filter=v16_ -d v16_dbname
Start Odoo from shell update all without translation
./odoo-bin -c /home/workspace/myconfs/odoo16.conf --workers=0 --no-xmlrpc --stop-after-init --db-filter=v16_ -d v16_ -u all
Start Odoo from shell update all with translation
./odoo-bin -c /home/workspace/myconfs/odoo16.conf --i18n-overwrite --load-language=de_DE --workers=0 --no-xmlrpc --stop-after-init --db-filter=v16_ -d v16_ -u all
URL for Odoo in Browser: devxx.myodoo.sh > internal Port 8069
A second Odoo session can be started via port 9069 > devxx-2.myodoo.sh (with separate Odoo Config file → xmlrpc_port = 9069)
Important directories:
In /home/workspace/odoo-share: here is odoo filestorage
In /home/workspace/uploads: database Zips
In /opt/venv: Python environments
Kill all Python processes
Kill all Python processes
# kill
pkill -9 python
# check
pgrep python
Make your own Config files
Create a new folder conf e.g. under /home/workspace/conf and create your own config file there. (Right click > New file)
Accordingly the start path for the DB must be adapted to ./odoo-bin -c /home/workspace/myconfs/odoo12_xy.conf
Pull process
Over Terminal:
pull with shell
git pull
or like written before in section "Pull repositories"
Commit & Push process
Stage changes over the plus sign:
Enter a commit message:
Shortcut Control + Enter = Commit
Push over the arrow sign:
OR over the 3 dots > Push
Open second terminal:
To open another terminal, go to the plus sign in the terminal next to the dropdown:
Switch between the two terminals using the dropdown:
If there are more than two terminals, it is recommended to use tmux (see below).
SQL queries over PG Admin in browser
URL: pgxx.ownerp.io
+ User from 1Password.
If a DB cannot be deleted, open sessions can be the reason then kill session in PG Admin:
look in https://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection
SELECT pg_terminate_backend(pid) FROM pg_stat_activity
WHERE
-- don't kill my own connection!
pid <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'database_name';