coreapp new --postgres: apps with their own database
A template overlay (templates/postgres) adds DEPENDS="postgresql", DB_* settings with a random password, an install that creates the user and database on the Core's PostgreSQL (safe to re-run), an uninstall that drops them, and a Python example that counts visits. Tested with a throwaway app: deploy, redeploy and a reboot of the Core keep the data, remove drops the database and user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+6
@@ -0,0 +1,6 @@
|
||||
# Sourced by the Core's uninstallapp (so no `exit` here): stop the app and
|
||||
# delete its settings, data and database
|
||||
docker compose -f /federated/apps/{{NAME}}/docker-compose.yml -p {{NAME}} down
|
||||
rm -rf /federated/apps/{{NAME}}
|
||||
docker exec postgresql psql -U postgres -qc "DROP DATABASE IF EXISTS {{DBNAME}}"
|
||||
docker exec postgresql psql -U postgres -qc "DROP USER IF EXISTS {{DBNAME}}"
|
||||
Reference in New Issue
Block a user