b819eb35b0
Issue #50 (AmneziaWG 2.0 / awg2): "Failed to generate client keys" when creating clients, and "Invalid server response" on first install. - VpnClient::generateClientKeys() built its own password-only SSH command (PubkeyAuthentication=no, no sudo), bypassing VpnServer::executeCommand. That broke key-based servers and hosts where docker requires sudo. Route it through executeCommand so SSH-key auth and docker sudo auto-detection apply, matching every other remote operation. - VpnClient::getNextClientIP() read /opt/amnezia/awg/wg0.conf only; AWG2 uses awg0.conf. Read awg0.conf first, fall back to wg0.conf. - deploy route: lift PHP time limit (set_time_limit(0) + ignore_user_abort) so the multi-minute awg2 docker build is not killed mid-request, which produced the truncated, non-JSON "Invalid server response". - migration 070: drop `--no-cache` from the awg2 docker build so layers are reused, making installs and retries fast and idempotent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Database Migrations
This directory contains SQL migration files that are automatically executed when the database container is first initialized.
Execution Order
Migration files are executed in alphabetical order by MySQL's Docker entrypoint. Files are numbered to ensure correct execution sequence:
001_init.sql- Main database schema and tables002_translations_ru.sql- Russian translations003_translations_es.sql- Spanish translations004_translations_de.sql- German translations005_translations_fr.sql- French translations006_translations_zh.sql- Chinese translations
Adding New Migrations
When creating new migration files:
- Use numerical prefix (e.g.,
007_add_feature.sql) - Ensure the number is higher than existing migrations
- Use descriptive names
- Always use
ON DUPLICATE KEY UPDATEfor INSERT statements to make migrations idempotent
Manual Execution
To manually run migrations in an existing database:
# Single migration
docker compose exec db mysql -uroot -prootpassword amnezia_panel < migrations/001_init.sql
# All migrations in order
for file in migrations/*.sql; do
echo "Executing $file..."
docker compose exec -T db mysql -uroot -prootpassword amnezia_panel < "$file"
done
Regenerating Translation Migrations
To regenerate translation migrations from the current database:
# Export translations for a specific language
docker compose exec -T db mysql -uroot -prootpassword amnezia_panel \
--default-character-set=utf8mb4 \
-e "SELECT CONCAT('(''', language_code, ''', ''', translation_key, ''', ''',
REPLACE(translation_value, '''', ''''''), '''),')
FROM translations WHERE language_code = 'ru' ORDER BY translation_key;" \
| grep -v "CONCAT" > /tmp/translations_ru.sql
# Then wrap with INSERT statement and ON DUPLICATE KEY UPDATE