5.8 KiB
5.8 KiB
Installation Guide / Installationsanleitung
English Version
Prerequisites
- Node.js 18 or higher
- PostgreSQL 12 or higher
- npm (comes with Node.js)
Quick Installation
-
Extract files to your server
cd /your/installation/directory -
Run the setup script
chmod +x setup.sh ./setup.shThe script will:
- Create the PostgreSQL database and user
- Set up environment variables
- Run database migrations
- Install Node.js dependencies
- Create necessary directories
-
Start the server
npm start -
Access the application Open your browser to: http://localhost:3000
Manual Installation
If you prefer to install manually:
-
Create PostgreSQL database
sudo -u postgres psql CREATE DATABASE quotes_db; CREATE USER quoteuser WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE quotes_db TO quoteuser; \q -
Run database migrations
psql -U quoteuser -d quotes_db -f init.sql psql -U quoteuser -d quotes_db -f add_invoices.sql -
Install dependencies
npm install -
Configure environment
cp .env.example .env # Edit .env with your settings -
Create directories
mkdir -p public/uploads -
Start the server
npm start
Deutsche Version
Voraussetzungen
- Node.js 18 oder höher
- PostgreSQL 12 oder höher
- npm (kommt mit Node.js)
Schnell-Installation
-
Dateien auf deinen Server entpacken
cd /dein/installations/verzeichnis -
Setup-Script ausführen
chmod +x setup.sh ./setup.shDas Script wird:
- PostgreSQL-Datenbank und Benutzer erstellen
- Umgebungsvariablen einrichten
- Datenbank-Migrationen ausführen
- Node.js-Abhängigkeiten installieren
- Notwendige Verzeichnisse erstellen
-
Server starten
npm start -
Anwendung öffnen Browser öffnen: http://localhost:3000
Manuelle Installation
Falls du lieber manuell installieren möchtest:
-
PostgreSQL-Datenbank erstellen
sudo -u postgres psql CREATE DATABASE quotes_db; CREATE USER quoteuser WITH PASSWORD 'dein_passwort'; GRANT ALL PRIVILEGES ON DATABASE quotes_db TO quoteuser; \q -
Datenbank-Migrationen ausführen
psql -U quoteuser -d quotes_db -f init.sql psql -U quoteuser -d quotes_db -f add_invoices.sql -
Abhängigkeiten installieren
npm install -
Umgebung konfigurieren
cp .env.example .env # .env mit deinen Einstellungen bearbeiten -
Verzeichnisse erstellen
mkdir -p public/uploads -
Server starten
npm start
File Structure / Dateistruktur
quote-invoice-system/
├── server.js # Express server / Backend-Server
├── public/
│ ├── index.html # Main UI / Hauptoberfläche
│ ├── app.js # Frontend JavaScript
│ └── uploads/ # Logo storage / Logo-Speicher
├── package.json # Dependencies / Abhängigkeiten
├── init.sql # Initial DB schema / Initiales DB-Schema
├── add_invoices.sql # Invoice tables / Rechnungs-Tabellen
├── setup.sh # Auto-installation / Auto-Installation
├── .env.example # Environment template / Umgebungs-Vorlage
└── README.md # Documentation / Dokumentation
Troubleshooting / Fehlerbehebung
Database connection fails / Datenbankverbindung fehlgeschlagen
- Check PostgreSQL is running:
sudo systemctl status postgresql - Verify credentials in
.envfile - Ensure user has permissions:
GRANT ALL ON SCHEMA public TO quoteuser;
Port 3000 already in use / Port 3000 bereits belegt
- Change
PORTin.envfile - Or stop the service using port 3000
PDF generation fails / PDF-Generierung fehlgeschlagen
- Puppeteer requires Chromium
- On Ubuntu/Debian:
sudo apt-get install chromium-browser - On Alpine/Docker: Already configured in Dockerfile
Permission errors / Berechtigungsfehler
- Ensure
public/uploadsdirectory exists and is writable - Run:
chmod 755 public/uploads
Production Deployment / Produktions-Deployment
Using PM2 (Recommended / Empfohlen)
# Install PM2
npm install -g pm2
# Start application
pm2 start server.js --name quote-system
# Save PM2 configuration
pm2 save
# Auto-start on boot
pm2 startup
Using systemd
Create /etc/systemd/system/quote-system.service:
[Unit]
Description=Quote & Invoice System
After=network.target postgresql.service
[Service]
Type=simple
User=your_user
WorkingDirectory=/path/to/quote-invoice-system
Environment="NODE_ENV=production"
ExecStart=/usr/bin/node server.js
Restart=on-failure
[Install]
WantedBy=multi-user.target
Then:
sudo systemctl enable quote-system
sudo systemctl start quote-system
Security Recommendations / Sicherheitsempfehlungen
- Use strong database passwords / Starke Datenbank-Passwörter verwenden
- Run behind reverse proxy (nginx) / Hinter Reverse-Proxy betreiben
- Enable HTTPS / HTTPS aktivieren
- Regular backups / Regelmäßige Backups
- Keep dependencies updated / Abhängigkeiten aktuell halten
Backup / Sicherung
Database Backup / Datenbank-Backup
pg_dump -U quoteuser quotes_db > backup_$(date +%Y%m%d).sql
Restore / Wiederherstellen
psql -U quoteuser quotes_db < backup_20260131.sql
Support
For technical support / Für technischen Support:
- Check README.md for usage instructions
- Review error logs:
journalctl -u quote-system -f - Contact Bay Area Affiliates, Inc.