Created example env, updated docker-compose, added valkey to supervisord

This commit is contained in:
2026-01-19 19:05:45 +00:00
parent 35252fa1e8
commit 43fe875cde
9 changed files with 130 additions and 62 deletions

29
.env.example Normal file
View File

@@ -0,0 +1,29 @@
# Django settings
KEYWARDEN_SECRET_KEY=supersecret
KEYWARDEN_DEBUG=True
KEYWARDEN_ALLOWED_HOSTS=*
KEYWARDEN_TRUSTED_ORIGINS=https://localhost,https://127.0.0.1
# Database
KEYWARDEN_POSTGRES_DB=keywarden
KEYWARDEN_POSTGRES_USER=keywarden
KEYWARDEN_POSTGRES_PASSWORD=postgres
KEYWARDEN_POSTGRES_HOST=keywarden-db
KEYWARDEN_POSTGRES_PORT=5432
# Admin bootstrap
KEYWARDEN_ADMIN_USERNAME=admin
KEYWARDEN_ADMIN_EMAIL=admin@example.com
KEYWARDEN_ADMIN_PASSWORD=password
# Auth mode: native | oidc | hybrid
KEYWARDEN_AUTH_MODE=native
# OIDC (optional)
# KEYWARDEN_OIDC_CLIENT_ID=
# KEYWARDEN_OIDC_CLIENT_SECRET=
# KEYWARDEN_OIDC_AUTHORIZATION_ENDPOINT=
# KEYWARDEN_OIDC_TOKEN_ENDPOINT=
# KEYWARDEN_OIDC_USER_ENDPOINT=
# KEYWARDEN_OIDC_JWKS_ENDPOINT=

3
.gitignore vendored
View File

@@ -218,9 +218,6 @@ __marimo__/
# Certificates # Certificates
*.pem *.pem
# Docker
*compose.yml
nginx/logs/* nginx/logs/*
nginx/certs/*.pem nginx/certs/*.pem

View File

@@ -19,6 +19,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
nodejs \ nodejs \
npm \ npm \
supervisor \ supervisor \
valkey-server \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# ============================================= # =============================================

View File

@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2024, Valkey contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

22
THIRD_PARTY_NOTICES.md Normal file
View File

@@ -0,0 +1,22 @@
# Third-party notices
This project is licensed under the GNU AGPL v3. It includes third-party components that
are distributed under their own licenses. When redistributing Keywarden (source or binary),
ensure you comply with each component's license terms and include required notices.
## Valkey
Valkey is included in the container image and used as the cache backend.
License: BSD 3-Clause. See `LICENSES/valkey.BSD-3-Clause.txt`.
## Other third-party components
This repository and container image include additional dependencies (Python packages and
system packages). Their licenses typically require you to retain copyright notices and
license texts when redistributing binaries. Review the following sources to determine
exact obligations:
- `requirements.txt` for Python dependencies.
- `Dockerfile` for system packages installed into the image.
- `app/static/` and `app/theme/` for bundled frontend assets.
If you need a full license inventory, generate it from your build environment and add
corresponding license texts under `LICENSES/`.

View File

@@ -78,10 +78,12 @@ DATABASES = {
} }
} }
REDIS_URL = os.getenv("KEYWARDEN_REDIS_URL", "redis://127.0.0.1:6379/1")
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://keywarden-valkey:6379/1", "LOCATION": REDIS_URL,
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"},
} }
} }

36
docker-compose.yml Normal file
View File

@@ -0,0 +1,36 @@
services:
keywarden-db:
image: postgres:17-alpine
container_name: keywarden-db
environment:
POSTGRES_PASSWORD: ${KEYWARDEN_POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${KEYWARDEN_POSTGRES_DB:-keywarden}
POSTGRES_USER: ${KEYWARDEN_POSTGRES_USER:-keywarden}
POSTGRES_PORT: ${KEYWARDEN_POSTGRES_PORT:-5432}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U keywarden -d keywarden"]
interval: 5s
timeout: 5s
retries: 20
volumes:
- "pgdata:/var/lib/postgresql/data"
keywarden:
build: .
container_name: keywarden
volumes:
- ./app:/app
- ./nginx/certs:/certs:ro
- ./nginx/logs:/etc/nginx/logs
ports:
- "443:443"
depends_on:
- keywarden-db
environment:
- DJANGO_SETTINGS_MODULE=keywarden.settings.dev
- PYTHONPATH=/app
env_file:
- .env
volumes:
pgdata:

View File

@@ -1,58 +0,0 @@
services:
keywarden-nginx:
image: nginx:alpine
container_name: keywarden-nginx
restart: unless-stopped
volumes:
- ${DOCKERDIR}/nginx/configs/nginx.conf:/etc/nginx/nginx.conf:ro
- ${DOCKERDIR}/nginx/configs/sites:/etc/nginx/conf.d/
- ${DOCKERDIR}/nginx/certs/:/certs/
- ${DOCKERDIR}/nginx/webdir/:/var/www/
- ${DOCKERDIR}/nginx/logs:/var/log/nginx/
ports:
- "443:443"
keywarden-valkey:
image: valkey/valkey:latest
restart: unless-stopped
container_name: keywarden-valkey
environment:
- ALLOW_EMPTY_PASSWORD=yes
keywarden-db:
image: postgres:17-alpine
container_name: keywarden-db
environment:
POSTGRES_PASSWORD: ${KEYWARDEN_POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${KEYWARDEN_POSTGRES_DB:-keywarden}
POSTGRES_USER: ${KEYWARDEN_POSTGRES_USER:-keywarden}
POSTGRES_PORT: ${KEYWARDEN_POSTGRES_PORT:-5432}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U keywarden -d keywarden"]
interval: 5s
timeout: 5s
retries: 20
volumes:
- "pgdata:/var/lib/postgresql/data"
keywarden:
image: git.ntbx.io/boris/keywarden:latest
container_name: keywarden
command: sh ./entrypoint.sh
ports:
- "8000:80"
depends_on:
- keywarden-db
- keywarden-valkey
environment:
- DJANGO_SETTINGS_MODULE=keywarden.settings.dev
- PYTHONPATH=/app
- DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME}
- DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}
- DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
- KEYWARDEN_AUTH_MODE=${KEYWARDEN_AUTH_MODE:-hybrid}
env_file:
- .env
volumes:
pgdata:

View File

@@ -26,3 +26,13 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
stopsignal=QUIT stopsignal=QUIT
[program:valkey]
command=/usr/bin/valkey-server --bind 127.0.0.1 --port 6379 --save "" --appendonly no
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopsignal=TERM