Skip to content

🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

Docker Compose

sassanix6012874391cc
diff --git a/Docker/.env.example b/Docker/.env.example
new file mode 100644
index 0000000..9148b77
--- /dev/null
+++ b/Docker/.env.example
@@ -0,0 +1,9 @@
+# Database configuration
+DB_PASSWORD=warranty_password
+DB_ADMIN_PASSWORD=change_this_password_in_production
+
+# Email configuration
+SMTP_HOST=localhost
+SMTP_PORT=1025
+SMTP_PASSWORD=your_smtp_password
\ No newline at end of file
diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml
new file mode 100644
index 0000000..74fa545
--- /dev/null
+++ b/Docker/docker-compose.yml
@@ -0,0 +1,66 @@
+services:
+ warracker:
+ image: ghcr.io/sassanix/warracker/main:latest
+ ports:
+ - "8005:80"
+ volumes:
+ - warracker_uploads:/data/uploads
+ environment:
+ - DB_HOST=warrackerdb
+ - DB_NAME=warranty_db
+ - DB_USER=warranty_user
+ - DB_PASSWORD=${DB_PASSWORD:-warranty_password}
+ - SMTP_HOST=smtp.email.com
+ - SMTP_PORT=465
+ - SMTP_PASSWORD=password
+ depends_on:
+ - warrackerdb
+ restart: unless-stopped
+
+ # Using a standard PostgreSQL image with initialization
+ warrackerdb:
+ image: postgres:15-alpine
+ volumes:
+ - postgres_data:/var/lib/postgresql/data
+ environment:
+ - POSTGRES_DB=warranty_db
+ - POSTGRES_USER=warranty_user
+ - POSTGRES_PASSWORD=${DB_PASSWORD:-warranty_password}
+ # This will create the init script directly
+ - POSTGRES_MULTIPLE_DATABASES=warranty_db
+ - PGUSER=warranty_user
+ restart: unless-stopped
+ # Simple initialization approach
+ command: >
+ sh -c '
+ # Create initialization script
+ mkdir -p /docker-entrypoint-initdb.d
+ echo "CREATE TABLE IF NOT EXISTS warranties (
+ id SERIAL PRIMARY KEY,
+ product_name VARCHAR(255) NOT NULL,
+ product_url TEXT,
+ purchase_date DATE NOT NULL,
+ warranty_years INTEGER NOT NULL,
+ expiration_date DATE NOT NULL,
+ invoice_path TEXT,
+ manual_path TEXT,
+ purchase_price DECIMAL(10, 2)
+ );" > /docker-entrypoint-initdb.d/01-tables.sql
+
+ echo "CREATE TABLE IF NOT EXISTS serial_numbers (
+ id SERIAL PRIMARY KEY,
+ warranty_id INTEGER REFERENCES warranties(id) ON DELETE CASCADE,
+ serial_number VARCHAR(255) NOT NULL
+ );" > /docker-entrypoint-initdb.d/02-serial-numbers.sql
+
+ echo "CREATE INDEX IF NOT EXISTS idx_warranty_id ON serial_numbers(warranty_id);
+ CREATE INDEX IF NOT EXISTS idx_expiration_date ON warranties(expiration_date);" > /docker-entrypoint-initdb.d/03-indexes.sql
+
+ # Run the standard PostgreSQL entrypoint script
+ docker-entrypoint.sh postgres
+ '
+
+volumes:
+ postgres_data:
+ warracker_uploads:
\ No newline at end of file