Compare commits

...
4 Commits
Author SHA1 Message Date
Evgeny Volferts 8985d868ab fix: handle existing endpoint history table during AmneziaWG restore (#1368) 2026-10-31 22:25:32 +01:00
torms 675ec831b9 feat(docker): run drop-in scripts from /data/custom-init.d at startup (#1401)
Allows users to install additional packages or apply custom setup
by placing scripts in /data/custom-init.d, executed in alphabetical
order before WGDashboard starts.
2026-10-31 22:24:53 +01:00
Evgeny Volferts a748bfced1 fix: handle instantiated SQLAlchemy column types (#1400) 2026-10-31 22:21:50 +01:00
Theroxenes 3b3b13f9ee fix: add button type to accountSettingsInputPassword submission button (#1321) 2026-10-31 22:18:51 +01:00
5 changed files with 41 additions and 3 deletions
+15
View File
@@ -121,6 +121,20 @@ Updating the WGDashboard container should be through 'The Docker Way' - by pulli
---
## 🧩 Custom Startup Scripts
Every file placed in `/data/custom-init.d/` is executed with `bash` at container startup, in alphabetical order, right before WGDashboard starts. A failing script is logged but does not stop the container.
This is useful for installing additional packages, for example `/data/custom-init.d/apk-add`:
```bash
apk update > /dev/null 2>&1
apk add --no-cache util-linux openssh-client > /dev/null 2>&1
```
> 📁 When using a Docker volume for `/data`, you can also bind-mount the directory directly, e.g. `./custom-init.d:/data/custom-init.d:ro`.
---
## 🔐 Port Forwarding Note
When using multiple WireGuard interfaces, remember to **open their respective ports** on the host.
@@ -202,6 +216,7 @@ ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
- **`ensure_installation`**: Sets up the app, database, and Python environment.
- **`set_envvars`**: Writes `wg-dashboard.ini` and applies environment variables.
- **`run_custom_init`**: Runs user scripts from `/data/custom-init.d/`.
- **`start_core`**: Starts the main WGDashboard service.
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
+19
View File
@@ -258,6 +258,24 @@ set_envvars() {
done
}
# Run user-provided drop-in scripts, e.g. to install additional packages
run_custom_init() {
local init_dir="/data/custom-init.d"
[[ -d "$init_dir" ]] || return 0
printf "\n------------------ RUNNING CUSTOM SCRIPTS ------------------\n"
for script in "$init_dir"/*; do
[[ -f "$script" ]] || continue
echo "Running custom script: ${script}"
if ! bash "$script"; then
echo "Custom script ${script} exited with an error, continuing."
fi
done
}
# Start service and monitor logs
start_and_monitor() {
printf "\n---------------------- STARTING CORE -----------------------\n"
@@ -331,4 +349,5 @@ start_and_monitor() {
# Main execution flow
ensure_installation
set_envvars
run_custom_init
start_and_monitor
+2 -1
View File
@@ -170,7 +170,8 @@ class AmneziaConfiguration(WireguardConfiguration):
f'{dbName}_history_endpoint', self.metadata,
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
sqlalchemy.Column('time', time_col_type)
sqlalchemy.Column('time', time_col_type),
extend_existing=True
)
self.infoTable = sqlalchemy.Table(
+3 -1
View File
@@ -145,7 +145,9 @@ class DashboardConfig:
for col_name, col_type in expected_columns.items():
if col_name not in existing_columns:
type_str = col_type().compile(dialect=self.engine.dialect)
type_str = (
col_type if isinstance(col_type, db.types.TypeEngine) else col_type()
).compile(dialect=self.engine.dialect)
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
preparer = self.engine.dialect.identifier_preparer
quoted_table = preparer.quote_identifier(table_name)
@@ -130,6 +130,7 @@ export default {
</div>
</div>
<button
type="button"
:disabled="!this.passwordValid"
class="ms-auto btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm" @click="this.useValidation()">
<i class="bi bi-save2-fill me-2"></i>
@@ -141,4 +142,4 @@ export default {
<style scoped>
</style>
</style>