Fix duplicate entry and add mail schema init

This commit is contained in:
Alex D. 2024-10-18 07:47:10 +00:00
parent b276174405
commit 85df924c21
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 18 additions and 1 deletions

View File

@ -13,7 +13,7 @@ RUN ./postgres-seeder \
"gitea/gitea" \
"murmur/murmur" \
"postfix/mail" \
"postfix/mail"
"dovecot/mail"
# Spits out init.sql and pg_hba.conf
FROM postgres:alpine
@ -33,6 +33,7 @@ RUN chown -Rv postgres:postgres /etc/redxen/postgres-cert/
ADD postgresql.conf /etc/postgresql/postgresql.conf
COPY --from=init /root/pg_hba.conf /etc/postgresql/pg_hba.conf
COPY --from=init /root/init.sql /docker-entrypoint-initdb.d/init.sql
ADD databases/mail.sql /docker-entrypoint-initdb.d/mail.sql
# TODO: https://hub.docker.com/_/postgres > Initialisation scripts (Database)
CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]

View File

@ -0,0 +1,16 @@
CREATE TABLE users (
userid VARCHAR(128) NOT NULL,
password TEXT NOT NULL,
active BOOLEAN NOT NULL DEFAULT true,
PRIMARY KEY (userid),
UNIQUE (userid)
);
CREATE TABLE aliases (
target VARCHAR(128) NOT NULL,
alias VARCHAR(128) NOT NULL,
active BOOLEAN NOT NULL DEFAULT true,
PRIMARY KEY (alias),
UNIQUE (alias)
);
GRANT SELECT ON TABLE users TO dovecot;
GRANT SELECT ON TABLE users, aliases TO postfix;