Architecture Overview
This setup uses two Coolify-managed containers:
- Modules Container: Pulls modules from GitHub and keeps them available in a volume
- Odoo Container: Uses the modules by mounting the volume to /mnt/extra-addons
Implementation Steps
1. Create Modules Repository
- Create a GitHub repository for your custom Odoo modules
- Add a Dockerfile in the root with the following content:
dockerfile
Copy
FROM alpine:latest # Install git for fetching updates RUN apk add --no-cache git # Create odoo user and group with the same IDs as in the Odoo container RUN addgroup -g 101 odoo && adduser -u 101 -G odoo -h /mnt/extra-addons -D odoo # Set working directory WORKDIR /mnt/extra-addons # Copy all modules from the repository COPY . /mnt/extra-addons/ # Change ownership to odoo user RUN chown -R odoo:odoo /mnt/extra-addons # Keep container running CMD ["tail", "-f", "/dev/null"]
- Add your custom Odoo modules to the root of the repository
2. Deploy Modules Container in Coolify
- Create a new service in Coolify
- Select "Dockerfile" as the build pack
- Point to your GitHub repository with custom modules
- Configure auto-deployment from GitHub (optional)
- You need to give a volume name (xyzsss-modules) under Persistence storage in your container
- Leave the Source Path and put /mnt/extra-addons as the Destination Path
- Deplor or Redeploy your container
3. Configure Odoo Container
- Deploy a standard Odoo service using a coolify service, search for odoo and deploy it. The current docker image for odoo is at v17 but you can always use any available docker image.
- Modify the docker-compose.yml to use a bind mount to the modules:
yaml file
services: odoo: image: 'odoo:17' environment: # Your environment variables volumes: - 'odoo-web-data:/var/lib/odoo' - '/var/lib/docker/volumes/xyzsss-modules/_data:/mnt/extra-addons' # Rest of your configuration volumes: odoo-web-data: postgresql-data:
- Replace xyzsss-modules with your actual volume name
- We need to include /_data in our bind mount path because we're directly accessing Docker's internal storage structure. If we only specified the volume name without /_data, we would be pointing to the volume's metadata directory rather than the actual content.
- Deploy the Odoo service
4. Verify Configuration
- Connect to the Odoo container and check modules:
bash command
docker exec -it $(docker ps | grep odoo | awk '{print $1}') ls -la /mnt/extra-addons
- Log in to Odoo as admin
- Go to Apps
- Click "Update Apps List"
- Search for and install your custom modules
5. Auto-Deployment Workflow
When changes are pushed to your GitHub repository:
- Coolify pulls the latest code to the modules container
- The updated modules are immediately available to Odoo container
- In Odoo, you can update the modules to apply changes
Troubleshooting
- Empty /mnt/extra-addons: Check volume names and paths
- Modules not showing in Odoo: Run "Update Apps List" in Odoo
- Permission issues: Verify the modules are owned by odoo
Maintenance
- Monitor disk space for Docker volumes
- Regularly backup your Odoo database
- Consider implementing a staging environment for testing module changes