-
-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set up the postgres containers properly
I just learned this is how you're actually supposed to do it in order to mimic a real deployment as closely as possible. If you read the documentation for this docker image, you'll find that the user created via `POSTGRES_USER` has `SUPERUSER` rights. Generally, real deployments don't and shouldn't have this set for the database user of random services (such as Lemmy). The proper way to do this is to use the defaults and add an init script that adds the actual service user and database to this specific directory. This results in the Lemmy service user not having `SUPERUSER`, which ensures that future migrations aren't written with the concerning assumption that people will grant it `SUPERUSER` rights.
- Loading branch information
1 parent
fb7fe3b
commit 072e744
Showing
3 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB" <<-ESQL | ||
CREATE USER lemmy WITH PASSWORD 'password'; | ||
CREATE DATABASE lemmy WITH OWNER lemmy; | ||
GRANT ALL PRIVILEGES ON DATABASE lemmy TO lemmy; | ||
ESQL |