This guide uses Docker Compose to run Inventaire. Due to its multi-service architecture (CouchDB, Elasticsearch, and the main application), Docker Compose is the recommended deployment method.
For Docker installation, see Docker.
mkdir -p ~/inventaire && cd ~/inventaire
Create a docker-compose.yml file with the following content:
version: '3.8'
services:
couchdb:
image: couchdb:3.3
restart: unless-stopped
volumes:
- couchdb_data:/opt/couchdb/data
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=replace_with_secure_password
networks:
- inventaire_net
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.24
restart: unless-stopped
volumes:
- es_data:/usr/share/elasticsearch/data
- ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- xpack.security.enabled=false
ulimits:
memlock:
soft: -1
hard: -1
networks:
- inventaire_net
server:
image: codeberg.org/inventaire/inventaire:latest
restart: unless-stopped
depends_on:
- couchdb
- elasticsearch
ports:
- "3000:3000"
environment:
- INV_DATABASE_COUCHDB_URL=http://admin:replace_with_secure_password@couchdb:5984
- INV_DATABASE_COUCHDB_NAME=inventaire
- INV_ELASTICSEARCH_HOST=elasticsearch
- INV_ELASTICSEARCH_PORT=9200
- INV_APP_HOSTNAME=localhost
- INV_APP_PORT=3000
- INV_EMAIL_ALERTS_TO=admin@localhost
- INV_SMTP_HOST=localhost
- INV_SMTP_PORT=587
- INV_SMTP_SECURE=false
- INV_SESSION_SECRET=replace_with_strong_session_secret
networks:
- inventaire_net
volumes:
couchdb_data:
es_data:
networks:
inventaire_net:
driver: bridge
Create an elasticsearch.yml file:
cat > elasticsearch.yml << EOF
cluster.name: "inventaire-cluster"
node.name: "es-node1"
network.host: 0.0.0.0
http.port: 9200
discovery.type: single-node
action.auto_create_index: false
EOF
docker compose up -d
Check that all services are running:
docker compose ps
View logs to ensure everything is working correctly:
docker compose logs -f
Wait for the application to be fully initialized (this may take several minutes as CouchDB and Elasticsearch need to start up):
# Wait for the web interface to be available
curl -I http://localhost:3000
For production deployments, consider the following:
.env file to store sensitive information:cat > .env << EOF
COUCHDB_ADMIN_USER=admin
COUCHDB_ADMIN_PASSWORD=your_secure_password
ELASTICSEARCH_HEAP_SIZE=2g
INVENTAIRE_HOSTNAME=your-domain.com
SMTP_HOST=your-smtp-server.com
SMTP_PORT=587
ADMIN_EMAIL=your-email@domain.com
SESSION_SECRET=your_very_long_and_random_session_secret
EOF
Then reference these variables in your docker-compose.yml:
# In the couchdb service:
environment:
- COUCHDB_USER=${COUCHDB_ADMIN_USER}
- COUCHDB_PASSWORD=${COUCHDB_ADMIN_PASSWORD}
# In the server service:
environment:
- INV_DATABASE_COUCHDB_URL=http://${COUCHDB_ADMIN_USER}:${COUCHDB_ADMIN_PASSWORD}@couchdb:5984
- INV_APP_HOSTNAME=${INVENTAIRE_HOSTNAME}
- INV_EMAIL_ALERTS_TO=${ADMIN_EMAIL}
- INV_SMTP_HOST=${SMTP_HOST}
- INV_SMTP_PORT=${SMTP_PORT}
- INV_SESSION_SECRET=${SESSION_SECRET}
Reverse Proxy: Set up nginx or Apache as a reverse proxy with SSL/TLS.
Resource Allocation: Adjust memory limits based on your hardware capacity.
Monitoring: Implement monitoring for the application and its services.
# Check current value
sysctl vm.max_map_count
# Set temporarily
sudo sysctl -w vm.max_map_count=262144
# Set permanently in /etc/sysctl.conf
echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
Application takes too long to start: The first startup involves database initialization which can take several minutes.
Database connection errors: Ensure that CouchDB and Elasticsearch are fully started before the main application attempts to connect.
codeberg.org/inventaire/inventaire:latest should be replaced with a specific version tag for production.Any questions?
Feel free to contact us. Find all contact information on our contact page.