Compare commits
2 Commits
ee13556c5c
...
b992b151d3
| Author | SHA1 | Date | |
|---|---|---|---|
| b992b151d3 | |||
| 87b8414e44 |
+9
-9
@@ -8,7 +8,7 @@ This guide provides easy installation instructions for PicPeak on Linux servers
|
||||
|
||||
```bash
|
||||
# Download and run the unified setup script
|
||||
curl -fsSL https://raw.githubusercontent.com/yourusername/wedding-photo-sharing/main/scripts/setup.sh -o setup.sh && \
|
||||
curl -fsSL https://raw.githubusercontent.com/the-luap/picpeak/main/scripts/setup.sh -o setup.sh && \
|
||||
chmod +x setup.sh && \
|
||||
sudo ./setup.sh
|
||||
```
|
||||
@@ -305,9 +305,9 @@ docker compose restart
|
||||
```
|
||||
|
||||
### Native Configuration
|
||||
Edit `/opt/picpeak/backend/.env`:
|
||||
Edit `/opt/picpeak/app/backend/.env`:
|
||||
```bash
|
||||
sudo nano /opt/picpeak/backend/.env
|
||||
sudo nano /opt/picpeak/app/backend/.env
|
||||
sudo systemctl restart picpeak-backend
|
||||
```
|
||||
|
||||
@@ -369,7 +369,7 @@ tar -czf photos-backup.tar.gz storage/events/
|
||||
#### Native:
|
||||
```bash
|
||||
# Database backup
|
||||
sudo cp /opt/picpeak/backend/database.sqlite /backup/database-$(date +%Y%m%d).sqlite
|
||||
sudo cp /opt/picpeak/app/backend/data/photo_sharing.db /backup/database-$(date +%Y%m%d).sqlite
|
||||
|
||||
# Photos backup
|
||||
sudo tar -czf /backup/photos-$(date +%Y%m%d).tar.gz /opt/picpeak/events/
|
||||
@@ -446,7 +446,7 @@ ls -la ~/picpeak/storage/events/
|
||||
docker exec picpeak-backend node scripts/reset-admin-password.js
|
||||
|
||||
# Native
|
||||
cd /opt/picpeak/backend
|
||||
cd /opt/picpeak/app/backend
|
||||
sudo -u picpeak node scripts/reset-admin-password.js
|
||||
```
|
||||
|
||||
@@ -458,11 +458,11 @@ sudo -u picpeak node scripts/reset-admin-password.js
|
||||
- Installation: `/tmp/picpeak-setup-*.log`
|
||||
|
||||
2. **Documentation:**
|
||||
- [Full Documentation](https://github.com/yourusername/wedding-photo-sharing)
|
||||
- [Full Documentation](https://github.com/the-luap/picpeak)
|
||||
- [Deployment Guide](./DEPLOYMENT_GUIDE.md)
|
||||
|
||||
3. **Support:**
|
||||
- [GitHub Issues](https://github.com/yourusername/wedding-photo-sharing/issues)
|
||||
- [GitHub Issues](https://github.com/the-luap/picpeak/issues)
|
||||
- Include: Error messages, system info (`uname -a`), installation method
|
||||
|
||||
## 🔒 Security Best Practices
|
||||
@@ -498,7 +498,7 @@ services:
|
||||
### Native Optimization
|
||||
```bash
|
||||
# Increase Node.js memory
|
||||
echo "NODE_OPTIONS=--max-old-space-size=2048" >> /opt/picpeak/backend/.env
|
||||
echo "NODE_OPTIONS=--max-old-space-size=2048" >> /opt/picpeak/app/backend/.env
|
||||
sudo systemctl restart picpeak-backend
|
||||
```
|
||||
|
||||
@@ -540,4 +540,4 @@ sudo ./setup.sh --native \
|
||||
|
||||
---
|
||||
|
||||
**PicPeak Setup v1.0** | [Documentation](https://github.com/yourusername/wedding-photo-sharing) | [Support](https://github.com/yourusername/wedding-photo-sharing/issues)
|
||||
**PicPeak Setup v1.0** | [Documentation](https://github.com/the-luap/picpeak) | [Support](https://github.com/the-luap/picpeak/issues)
|
||||
|
||||
+32
-24
@@ -26,29 +26,37 @@ const config = {
|
||||
|
||||
production: {
|
||||
client: process.env.DATABASE_CLIENT || 'pg',
|
||||
connection: {
|
||||
host: process.env.DB_HOST || 'db',
|
||||
port: process.env.DB_PORT || 5432,
|
||||
user: process.env.DB_USER || 'picpeak',
|
||||
password: process.env.DB_PASSWORD,
|
||||
database: process.env.DB_NAME || 'picpeak',
|
||||
ssl: process.env.DB_SSL === 'true' ? { rejectUnauthorized: false } : false,
|
||||
// Connection stability settings
|
||||
connectionTimeoutMillis: 30000,
|
||||
idleTimeoutMillis: 30000,
|
||||
keepAlive: true,
|
||||
keepAliveInitialDelayMillis: 0
|
||||
},
|
||||
pool: {
|
||||
min: 5,
|
||||
max: 25,
|
||||
acquireTimeoutMillis: 60000,
|
||||
createTimeoutMillis: 60000,
|
||||
idleTimeoutMillis: 30000,
|
||||
reapIntervalMillis: 1000,
|
||||
createRetryIntervalMillis: 200,
|
||||
propagateCreateError: false
|
||||
},
|
||||
// Support both Postgres and SQLite in production based on DATABASE_CLIENT
|
||||
connection: (process.env.DATABASE_CLIENT || 'pg') === 'pg'
|
||||
? {
|
||||
host: process.env.DB_HOST || 'db',
|
||||
port: process.env.DB_PORT || 5432,
|
||||
user: process.env.DB_USER || 'picpeak',
|
||||
password: process.env.DB_PASSWORD,
|
||||
database: process.env.DB_NAME || 'picpeak',
|
||||
ssl: process.env.DB_SSL === 'true' ? { rejectUnauthorized: false } : false,
|
||||
// Connection stability settings
|
||||
connectionTimeoutMillis: 30000,
|
||||
idleTimeoutMillis: 30000,
|
||||
keepAlive: true,
|
||||
keepAliveInitialDelayMillis: 0
|
||||
}
|
||||
: {
|
||||
filename: path.join(__dirname, process.env.DATABASE_PATH || './data/photo_sharing.db')
|
||||
},
|
||||
useNullAsDefault: (process.env.DATABASE_CLIENT || 'pg') !== 'pg',
|
||||
pool: (process.env.DATABASE_CLIENT || 'pg') === 'pg'
|
||||
? {
|
||||
min: 5,
|
||||
max: 25,
|
||||
acquireTimeoutMillis: 60000,
|
||||
createTimeoutMillis: 60000,
|
||||
idleTimeoutMillis: 30000,
|
||||
reapIntervalMillis: 1000,
|
||||
createRetryIntervalMillis: 200,
|
||||
propagateCreateError: false
|
||||
}
|
||||
: undefined,
|
||||
migrations: {
|
||||
directory: './migrations'
|
||||
},
|
||||
@@ -56,4 +64,4 @@ const config = {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config[process.env.NODE_ENV || 'development'];
|
||||
module.exports = config[process.env.NODE_ENV || 'development'];
|
||||
|
||||
+27
-21
@@ -13,7 +13,7 @@ IFS=$'\n\t'
|
||||
# Script configuration
|
||||
readonly SCRIPT_VERSION="2.0.0"
|
||||
readonly APP_NAME="PicPeak"
|
||||
readonly REPO_URL="https://github.com/yourusername/wedding-photo-sharing"
|
||||
readonly REPO_URL="https://github.com/the-luap/picpeak.git"
|
||||
readonly NODE_VERSION="20"
|
||||
readonly MIN_RAM_DOCKER=2048
|
||||
readonly MIN_RAM_NATIVE=1024
|
||||
@@ -551,20 +551,22 @@ setup_native_installation() {
|
||||
|
||||
# Create application directory
|
||||
log_step "Creating application directory..."
|
||||
mkdir -p "$NATIVE_APP_DIR"/{backend,events/{active,archived},logs,config}
|
||||
mkdir -p "$NATIVE_APP_DIR"/{app,events/{active,archived},logs,config}
|
||||
|
||||
# Clone repository
|
||||
log_step "Downloading PicPeak..."
|
||||
if [[ -d "$NATIVE_APP_DIR/backend/.git" ]]; then
|
||||
cd "$NATIVE_APP_DIR/backend"
|
||||
if [[ -d "$NATIVE_APP_DIR/app/.git" ]]; then
|
||||
cd "$NATIVE_APP_DIR/app"
|
||||
git pull
|
||||
else
|
||||
git clone "$REPO_URL" "$NATIVE_APP_DIR/backend"
|
||||
git clone "$REPO_URL" "$NATIVE_APP_DIR/app"
|
||||
fi
|
||||
|
||||
# Install dependencies
|
||||
log_step "Installing dependencies..."
|
||||
cd "$NATIVE_APP_DIR/backend"
|
||||
# The repository root contains both backend/ and frontend/
|
||||
# Install backend production dependencies
|
||||
cd "$NATIVE_APP_DIR/app/backend"
|
||||
npm install --production
|
||||
|
||||
# Generate secrets
|
||||
@@ -573,7 +575,7 @@ setup_native_installation() {
|
||||
|
||||
# Create .env file
|
||||
log_step "Creating configuration..."
|
||||
cat > "$NATIVE_APP_DIR/backend/.env" <<EOF
|
||||
cat > "$NATIVE_APP_DIR/app/backend/.env" <<EOF
|
||||
# PicPeak Native Configuration
|
||||
# Generated: $(date)
|
||||
|
||||
@@ -587,11 +589,12 @@ ADMIN_USERNAME=admin
|
||||
ADMIN_PASSWORD=$ADMIN_PASSWORD
|
||||
ADMIN_EMAIL=$ADMIN_EMAIL
|
||||
|
||||
# Database
|
||||
DATABASE_PATH=$NATIVE_APP_DIR/backend/database.sqlite
|
||||
# Database (native uses SQLite by default)
|
||||
DATABASE_CLIENT=sqlite3
|
||||
DATABASE_PATH=$NATIVE_APP_DIR/app/backend/data/photo_sharing.db
|
||||
|
||||
# Storage
|
||||
PHOTOS_DIR=$NATIVE_APP_DIR/events
|
||||
# Storage root (thumbnails/uploads live under this path)
|
||||
STORAGE_PATH=$NATIVE_APP_DIR
|
||||
|
||||
# Email
|
||||
SMTP_ENABLED=${SMTP_HOST:+true}
|
||||
@@ -618,11 +621,11 @@ EOF
|
||||
|
||||
# Set permissions
|
||||
chown -R $NATIVE_APP_USER:$NATIVE_APP_USER "$NATIVE_APP_DIR"
|
||||
chmod 600 "$NATIVE_APP_DIR/backend/.env"
|
||||
chmod 600 "$NATIVE_APP_DIR/app/backend/.env"
|
||||
|
||||
# Run database migrations
|
||||
log_step "Initializing database..."
|
||||
cd "$NATIVE_APP_DIR/backend"
|
||||
cd "$NATIVE_APP_DIR/app/backend"
|
||||
sudo -u $NATIVE_APP_USER npm run migrate
|
||||
|
||||
# Create systemd services
|
||||
@@ -654,7 +657,7 @@ After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$NATIVE_APP_USER
|
||||
WorkingDirectory=$NATIVE_APP_DIR/backend
|
||||
WorkingDirectory=$NATIVE_APP_DIR/app/backend
|
||||
Environment="NODE_ENV=production"
|
||||
ExecStart=/usr/bin/node server.js
|
||||
Restart=always
|
||||
@@ -675,7 +678,7 @@ After=network.target picpeak-backend.service
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$NATIVE_APP_USER
|
||||
WorkingDirectory=$NATIVE_APP_DIR/backend
|
||||
WorkingDirectory=$NATIVE_APP_DIR/app/backend
|
||||
Environment="NODE_ENV=production"
|
||||
ExecStart=/usr/bin/node src/services/workerManager.js
|
||||
Restart=always
|
||||
@@ -878,8 +881,8 @@ print_success_message() {
|
||||
echo
|
||||
echo "📚 Documentation:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "Setup Guide: https://github.com/yourusername/wedding-photo-sharing/blob/main/SIMPLE_SETUP.md"
|
||||
echo "Full Docs: https://github.com/yourusername/wedding-photo-sharing"
|
||||
echo "Setup Guide: https://github.com/the-luap/picpeak/blob/main/SIMPLE_SETUP.md"
|
||||
echo "Full Docs: https://github.com/the-luap/picpeak"
|
||||
echo
|
||||
echo -e "${GREEN}✨ Setup complete! Visit the admin panel to start creating galleries.${NC}"
|
||||
}
|
||||
@@ -935,13 +938,16 @@ update_native_installation() {
|
||||
systemctl stop picpeak-backend picpeak-workers
|
||||
|
||||
# Backup current configuration
|
||||
cp "$NATIVE_APP_DIR/backend/.env" "$NATIVE_APP_DIR/backend/.env.backup-$(date +%Y%m%d-%H%M%S)"
|
||||
if [[ -f "$NATIVE_APP_DIR/app/backend/.env" ]]; then
|
||||
cp "$NATIVE_APP_DIR/app/backend/.env" "$NATIVE_APP_DIR/app/backend/.env.backup-$(date +%Y%m%d-%H%M%S)"
|
||||
fi
|
||||
|
||||
# Pull latest code
|
||||
cd "$NATIVE_APP_DIR/backend"
|
||||
cd "$NATIVE_APP_DIR/app"
|
||||
sudo -u $NATIVE_APP_USER git pull
|
||||
|
||||
# Update dependencies
|
||||
# Update backend dependencies
|
||||
cd "$NATIVE_APP_DIR/app/backend"
|
||||
sudo -u $NATIVE_APP_USER npm install --production
|
||||
|
||||
# Run migrations
|
||||
@@ -1181,4 +1187,4 @@ main() {
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user