Environment Configuration
On-Prem Deployment Guide (Azure)
Step 1: Create Environment File
Where to go: Your VM in the hivel-onprem directory
cd /opt/hivel-onprem
# Copy template
cp config/.env.template config/.env
# Edit configuration
nano config/.envStep 2: Configure Database Credentials
Important: Use a two-phase credential approach. Configure admin credentials first (for migration), then switch to application user credentials (for services).
Phase 1: Admin Credentials for Migration
For flyway-migration only, use your PostgreSQL server admin credentials. Update these values in config/.env:
# ============================================
# Database Configuration (Azure PostgreSQL) - Phase 1: Migration
# ============================================
# Your Azure PostgreSQL server host (from Azure Portal)
DB_HOST=your-server.postgres.database.azure.com
# Port (usually 5432)
DB_PORT=5432
# Database name (must be "insightly")
DB_NAME=insightly
# Server admin username (for migration only)
DB_USER=postgres
# Server admin password (for migration only)
# Use single quotes if password contains special characters: ()[]$&|;#<>*
DB_PASSWORD='your_admin_password'
If credentials are stored in Azure Key Vault, retrieve the admin credentials before updating .env.
Phase 2: Application User Credentials for Services
After flyway-migration completes successfully, update config/.env to use the application user. Flyway automatically creates this user:
Default application credentials created by flyway-migration:
Username:
<user>Password:
<password>(default, can be customized)
Customizing the Application Password
If you want a different password for the application user:
Before running flyway-migration: Update the password in the flyway migration scripts/config
After migration: Update the password in
config/.envto match
Password Formatting
Passwords with special characters
()[]$&|;#<>*: Must use single quotes Example:DB_PASSWORD='Uxt2Z<XGvb0a7[4nc*zNJd)z#qGQ'If password contains a literal
$: Write it as$$inside single quotes (Docker Compose interpolates variables, so$$escapes to a literal$)Single quotes cannot appear inside the password itself (e.g.,
pass'wordis not allowed), but you can enclose the entire password in single quotes
Why single quotes? The deployment script sources the .env file, and bash interprets special characters as commands. Single quotes prevent this. The quotes are not passed to Docker. They're only for bash's benefit.
Step 3: Test Database Connection
Where to go: Your VM
Install the PostgreSQL client (if not already installed) and test the connection:
Expected result: A psql prompt (insightly=#) with no password or connection errors.
If it fails: see Database connection issues in Troubleshooting.
If connection succeeds: You're ready to proceed to the next step.
Next Step: Database Migration
Last updated