feat(install): enhance application configuration with JWT and S3 settings
This commit is contained in:
@@ -30,29 +30,66 @@ $STD npm ci
|
||||
$STD npm run build
|
||||
msg_ok "Built Application"
|
||||
|
||||
msg_info "Creating Directories"
|
||||
mkdir -p /etc/puter /var/puter
|
||||
msg_ok "Created Directories"
|
||||
|
||||
msg_info "Configuring Application"
|
||||
mkdir -p /etc/puter/extensions /var/puter/s3-data /var/puter/s3-storage
|
||||
JWT_SECRET=$(openssl rand -hex 64)
|
||||
URL_SIGNATURE_SECRET=$(openssl rand -hex 64)
|
||||
cat <<EOF >/etc/puter/config.json
|
||||
{
|
||||
"config_name": "proxmox",
|
||||
"env": "prod",
|
||||
"domain": "${LOCAL_IP}.nip.io",
|
||||
"domain": "puter.${LOCAL_IP}.nip.io",
|
||||
"protocol": "http",
|
||||
"port": 4100,
|
||||
"pub_port": 4100,
|
||||
"allow_nipio_domains": true,
|
||||
"jwt_secret": "${JWT_SECRET}",
|
||||
"url_signature_secret": "${URL_SIGNATURE_SECRET}",
|
||||
"extensions": ["/etc/puter/extensions"],
|
||||
"database": {
|
||||
"engine": "sqlite",
|
||||
"path": "/var/puter/puter-database.sqlite"
|
||||
},
|
||||
"redis": {
|
||||
"useMock": true
|
||||
},
|
||||
"dynamo": {
|
||||
"inMemory": true,
|
||||
"bootstrapTables": true,
|
||||
"aws": {
|
||||
"access_key": "fake",
|
||||
"secret_key": "fake",
|
||||
"region": "us-east-1"
|
||||
}
|
||||
},
|
||||
"s3": {
|
||||
"localConfig": {
|
||||
"inMemory": false,
|
||||
"dataDir": "/var/puter/s3-data",
|
||||
"s3StorageDir": "/var/puter/s3-storage"
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
"ollama": { "enabled": false }
|
||||
}
|
||||
}
|
||||
EOF
|
||||
cat <<'EXTEOF' >/etc/puter/extensions/subdomain-fix.cjs
|
||||
'use strict';
|
||||
// Puter extension: fix Express subdomain offset for multi-part nip.io domains.
|
||||
// By default Express uses offset=2 (correct for puter.com / puter.localhost).
|
||||
// For nip.io IP domains (e.g. puter.192.168.0.151.nip.io = 7 parts) the offset
|
||||
// must equal the domain part count so the homepage route matches correctly.
|
||||
const { extension } = require('/opt/puter/dist/src/backend/extensions.js');
|
||||
const domain = (extension.config && extension.config.domain) || 'puter.localhost';
|
||||
const offset = domain.split('.').length;
|
||||
if (offset !== 2) {
|
||||
extension.registerGlobalMiddleware(function subdomainOffsetFix(req, _res, next) {
|
||||
req.app.set('subdomain offset', offset);
|
||||
next();
|
||||
});
|
||||
}
|
||||
EXTEOF
|
||||
msg_ok "Configured Application"
|
||||
|
||||
msg_info "Creating Service"
|
||||
|
||||
Reference in New Issue
Block a user