Add support for local deployment target in Pokedex deployment scripts

This commit is contained in:
2026-01-30 04:57:41 +00:00
parent aa8b05d6bf
commit b82e2f2424
2 changed files with 24 additions and 10 deletions

View File

@@ -41,6 +41,9 @@ const SSH_HOSTS = {
port: 2323, port: 2323,
username: 'GregRJacobs', username: 'GregRJacobs',
privateKeyPath: '~/.ssh/ds3627xs_gregrjacobs' privateKeyPath: '~/.ssh/ds3627xs_gregrjacobs'
},
local: {
host: 'localhost'
} }
}; };
@@ -81,7 +84,7 @@ function parseArgs() {
// Validate target // Validate target
if (!SSH_HOSTS[config.target]) { if (!SSH_HOSTS[config.target]) {
throw new Error( throw new Error(
`Invalid target: ${config.target}. Must be 'internal' or 'external'.` `Invalid target: ${config.target}. Must be 'internal', 'external', or 'local'.`
); );
} }
@@ -207,12 +210,17 @@ async function deploy() {
try { try {
// Parse arguments // Parse arguments
const config = parseArgs(); const config = parseArgs();
const isLocal = config.target === 'local';
const sshConfig = SSH_HOSTS[config.target]; const sshConfig = SSH_HOSTS[config.target];
console.log('🚀 Starting Pokedex.Online deployment'); console.log('🚀 Starting Pokedex.Online deployment');
console.log( if (isLocal) {
`📡 Target: ${config.target} (${sshConfig.host}:${sshConfig.port})` console.log(`📡 Target: local`);
); } else {
console.log(
`📡 Target: ${config.target} (${sshConfig.host}:${sshConfig.port})`
);
}
console.log(`🔌 Frontend Port: ${config.port}`); console.log(`🔌 Frontend Port: ${config.port}`);
if (config.sslPort) { if (config.sslPort) {
console.log(`🔒 HTTPS Port: ${config.sslPort}`); console.log(`🔒 HTTPS Port: ${config.sslPort}`);
@@ -220,7 +228,9 @@ async function deploy() {
console.log(`🔌 Backend Port: ${config.backendPort}`); console.log(`🔌 Backend Port: ${config.backendPort}`);
// Connect to Synology using ~/.ssh/config // Connect to Synology using ~/.ssh/config
console.log('\n🔐 Connecting to Synology...'); if (!isLocal) {
console.log('\n🔐 Connecting to Synology...');
const keyPath = expandTilde(sshConfig.privateKeyPath); const keyPath = expandTilde(sshConfig.privateKeyPath);
console.log(` 🔑 Using SSH key: ${keyPath}`); console.log(` 🔑 Using SSH key: ${keyPath}`);
console.log( console.log(

View File

@@ -10,10 +10,10 @@
# ./deploy.sh [options] # ./deploy.sh [options]
# #
# Options: # Options:
# --target <internal|external> Deployment target (default: internal) # --target <internal|external|local> Deployment target (default: internal)
# --port <number> Frontend HTTP port (default: 8080) # --port <number> Frontend HTTP port (default: 8080)
# --ssl-port <number> Frontend HTTPS port (optional) # --ssl-port <number> Frontend HTTPS port (optional)
# --backend-port <number> Backend port (default: 3000) # --backend-port <number> Backend port (default: 3000)
# --skip-tests Skip test execution # --skip-tests Skip test execution
# --skip-build Skip build step (use existing dist/) # --skip-build Skip build step (use existing dist/)
# --no-backup Skip backup creation # --no-backup Skip backup creation
@@ -373,7 +373,11 @@ print_summary() {
echo "" echo ""
echo -e " ${YELLOW}Next Steps:${NC}" echo -e " ${YELLOW}Next Steps:${NC}"
echo -e " • Test the application manually" echo -e " • Test the application manually"
echo -e " • Check logs: npm run docker:logs" if [ "$TARGET" = "local" ]; then
echo -e " • Check logs: docker compose -f docker-compose.tmp.yml logs -f"
else
echo -e " • Check logs: npm run docker:logs"
fi
echo -e " • Monitor backend: curl http://$HOST:$BACKEND_PORT/health" echo -e " • Monitor backend: curl http://$HOST:$BACKEND_PORT/health"
echo "" echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"