Nix templates for Odoo development servers
(!) After INSTALL
Start server (postgres, odoo)
$ ./dev-server.sh start
When you want to import a database which takes a long time, use:
$ ./dev-server.sh start --limit-time-real=-1
This ensures the importer won't be killed for taking too long.
Other commands, just...
$ ./dev-server.sh
Example: psql
$ ./dev-server.sh psql
-
$ cp -R nix-odoo/odoo-VERSION TARGET
Where
VERSION
represents the Odoo version.Example:
$ cp -R nix-odoo/odoo-VERSION novacode-VERSION
-
$ cd TARGET
-
Edit odoo.conf
- addons_path
- db_host (absolute path to postgres socket-dir)
- http_port
- longpolling_port
- Other dirs/files (geoip, screenshots)
-
Add odoo (+ enterprise) dir
Example:
$ git clone https://github.com/odoo/odoo.git --branch 16.0 --depth 1
-
Add project AKA addons dir
The
dev-server.sh
script expects this as directory nameaddons
.Example:
$ git clone https://github.com/novacode-nl/novacode.git --branch 16.0 addons
-
(Optional) Add Git pre-commit (i) and Gitlint (ii) config files into the addons directory
(i) pre-commit framework:
(ii) Gitlint (Git commit message linter):
Example, copy from examples:
cp ../odoo-VERSION/pre-commit_EXAMPLES/.gitlint_EXAMPLE ./addons/.gitlint
cp ../odoo-VERSION/pre-commit_EXAMPLES/.pre-commit-config.yaml_EXAMPLE ./addons/.pre-commit-config.yaml
$ nix-build wkhtmltopdf.nix
$ ./dev-server.sh install
$ ./dev-server.sh start
- PostgreSQL listens (serves) from socket directory
- File
odoo-VERSION/pyproject.toml
(created from odoorequirements.txt
)
The upgrade script expects the old filestore located under the OS user it's ~/.local/share/Odoo/filestore/DB_NAME
directory.
So copy the filestore into that directory with same database name (DB_NAME
).
Having PostgreSQL running on a Unix socket causes issues with Odoo's upgrade script.
The upgrade script excepts PostgreSQL connection at /run/postgresql/.s.PGSQL.5432
.
Current workaround
Terminal (tty) 1
cd nix-odoo/TARGET
./dev-server postgres_tcp
Terminal (tty) 2
sudo su
mkdir /run/postgresql
ln -s nix-odoo/TARGET/postgres/.s.PGSQL.5432 /run/postgresql/
Run it and follow output (logging)
python <(curl -s https://upgrade.odoo.com/upgrade) test -d <your db name> -t <target version>
- Copy the migrated filestore directory into
nix-odoo/TARGET/data
. - Export dump (with filestore)
- Restore dump in new version
- Unclutter the root-dir
nix-odoo/
.git # this git repo
odoo-16/
# will become a git repo, eg. to share
.gitignore # odoo, postgres, data (liquid dirs, files)
dev-server.sh
pyproject.toml
README.md
shell.nix
odoo/
odoo.conf
addons/
.gitempty
(odoo/)
(enterprise/)
postgres/
.gitempty
data/
.gitempty
scripts/
prepare.sql
-
wkhtmltopdf (0.12.5) See file
wkhtmltopdf.nix
-
Generate
odoo-VERSION/pyproject.toml
from odoorequirements.txt