mirror of
https://github.com/WGDashboard/WGDashboard.git
synced 2026-12-02 09:27:46 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8985d868ab | ||
|
|
675ec831b9 | ||
|
|
a748bfced1 | ||
|
|
3b3b13f9ee |
@@ -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
|
## 🔐 Port Forwarding Note
|
||||||
|
|
||||||
When using multiple WireGuard interfaces, remember to **open their respective ports** on the host.
|
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.
|
- **`ensure_installation`**: Sets up the app, database, and Python environment.
|
||||||
- **`set_envvars`**: Writes `wg-dashboard.ini` and applies environment variables.
|
- **`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.
|
- **`start_core`**: Starts the main WGDashboard service.
|
||||||
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
|
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,24 @@ set_envvars() {
|
|||||||
done
|
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 service and monitor logs
|
||||||
start_and_monitor() {
|
start_and_monitor() {
|
||||||
printf "\n---------------------- STARTING CORE -----------------------\n"
|
printf "\n---------------------- STARTING CORE -----------------------\n"
|
||||||
@@ -331,4 +349,5 @@ start_and_monitor() {
|
|||||||
# Main execution flow
|
# Main execution flow
|
||||||
ensure_installation
|
ensure_installation
|
||||||
set_envvars
|
set_envvars
|
||||||
|
run_custom_init
|
||||||
start_and_monitor
|
start_and_monitor
|
||||||
|
|||||||
@@ -170,7 +170,8 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
f'{dbName}_history_endpoint', self.metadata,
|
f'{dbName}_history_endpoint', self.metadata,
|
||||||
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('endpoint', 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(
|
self.infoTable = sqlalchemy.Table(
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ class DashboardConfig:
|
|||||||
|
|
||||||
for col_name, col_type in expected_columns.items():
|
for col_name, col_type in expected_columns.items():
|
||||||
if col_name not in existing_columns:
|
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}'")
|
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
|
||||||
preparer = self.engine.dialect.identifier_preparer
|
preparer = self.engine.dialect.identifier_preparer
|
||||||
quoted_table = preparer.quote_identifier(table_name)
|
quoted_table = preparer.quote_identifier(table_name)
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
:disabled="!this.passwordValid"
|
: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()">
|
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>
|
<i class="bi bi-save2-fill me-2"></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user