chore(project): bootstrap project tree
This commit is contained in:
18
misc/containers/hydra/Dockerfile
Normal file
18
misc/containers/hydra/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM oryd/hydra:v1.4.2-alpine
|
||||
|
||||
USER root
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||
RUN chmod a+x /usr/local/bin/docker-entrypoint
|
||||
|
||||
COPY first-run.sh /usr/local/bin/docker-first-run
|
||||
RUN chmod a+x /usr/local/bin/docker-first-run
|
||||
|
||||
COPY hydra-init.d /hydra-init.d
|
||||
|
||||
RUN mkdir -p /home/ory && chown -R ory: /home/ory
|
||||
USER ory
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
|
||||
|
||||
CMD ["hydra", "serve", "all"]
|
14
misc/containers/hydra/docker-entrypoint.sh
Normal file
14
misc/containers/hydra/docker-entrypoint.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
LIFECYCLEFLAGS_DIR="$HOME/.container-lifecycle"
|
||||
|
||||
mkdir -p "$LIFECYCLEFLAGS_DIR"
|
||||
|
||||
if [ ! -f "$LIFECYCLEFLAGS_DIR/first-run" ]; then
|
||||
/usr/local/bin/docker-first-run
|
||||
touch "$LIFECYCLEFLAGS_DIR/first-run"
|
||||
fi
|
||||
|
||||
exec "$@"
|
8
misc/containers/hydra/first-run.sh
Normal file
8
misc/containers/hydra/first-run.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
hydra migrate sql -e -y
|
||||
|
||||
hydra serve all --dangerous-force-http &
|
||||
HYDRA_PID=$!
|
||||
run-parts --exit-on-error /hydra-init.d
|
||||
kill $HYDRA_PID
|
12
misc/containers/hydra/hydra-init.d/create-client
Executable file
12
misc/containers/hydra/hydra-init.d/create-client
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
hydra clients create \
|
||||
--id guesstimate \
|
||||
--secret guesstimate \
|
||||
-n Guesstimate \
|
||||
-a email,email_verified,openid \
|
||||
--token-endpoint-auth-method client_secret_post \
|
||||
--post-logout-callbacks http://localhost:8081/logout/redirect \
|
||||
-c http://localhost:8081/oauth2/callback
|
3
misc/containers/postgres/Dockerfile
Normal file
3
misc/containers/postgres/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM postgres:12-alpine
|
||||
|
||||
COPY ./initdb.d /docker-entrypoint-initdb.d
|
16
misc/containers/postgres/initdb.d/init-databases.sh
Normal file
16
misc/containers/postgres/initdb.d/init-databases.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
CREATE USER hydra WITH ENCRYPTED PASSWORD 'hydra';
|
||||
CREATE DATABASE hydra;
|
||||
GRANT ALL PRIVILEGES ON DATABASE hydra TO hydra;
|
||||
EOSQL
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
CREATE USER guesstimate WITH ENCRYPTED PASSWORD 'guesstimate';
|
||||
CREATE DATABASE guesstimate;
|
||||
GRANT ALL PRIVILEGES ON DATABASE guesstimate TO guesstimate;
|
||||
ALTER DATABASE guesstimate OWNER TO guesstimate;
|
||||
EOSQL
|
Reference in New Issue
Block a user