blob: edf8c43ef87d73e5caaf7f35c01dd2d94ca37d90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/bin/sh
source env-vars.sh
# Create a directory to store the certificates in.
if [ ! -d ${DOCKER_JWT_PUBKEY_PATH} ]; then
mkdir ${DOCKER_JWT_PUBKEY_PATH}
fi
# And for the htpasswd file.
if [ ! -d ${DOCKER_JWT_HTPASSWD_PATH} ]; then
mkdir ${DOCKER_JWT_HTPASSWD_PATH}
fi
# Generate new certificates to use for JWT.
if [ ! -f ${DOCKER_JWT_PUBKEY_PATH}/private.pem ] && [ ! -f ${DOCKER_JWT_PUBKEY_PATH}/public.pem ]; then
openssl ecparam -genkey -name prime256v1 -noout -out ${DOCKER_JWT_PUBKEY_PATH}/private.pem
chmod 644 ${DOCKER_JWT_PUBKEY_PATH}/private.pem
openssl ec -in ${DOCKER_JWT_PUBKEY_PATH}/private.pem -pubout -out ${DOCKER_JWT_PUBKEY_PATH}/public.pem
fi
# Generate a default htpasswd file with a user "usr:pwd".
if [ ! -f ${DOCKER_JWT_HTPASSWD_PATH}/.htpasswd ]; then
htpasswd -b -c ${DOCKER_JWT_HTPASSWD_PATH}/.htpasswd user1 pwd
htpasswd -b ${DOCKER_JWT_HTPASSWD_PATH}/.htpasswd user2 pwd
htpasswd -b ${DOCKER_JWT_HTPASSWD_PATH}/.htpasswd user3 pwd
htpasswd -b ${DOCKER_JWT_HTPASSWD_PATH}/.htpasswd user4 pwd
fi
# Launch the containers.
docker-compose -f docker/docker-compose-dev.yaml up -d
docker-compose -f auth-server-poc/docker-compose.yml up -d
|