diff --git a/cfssl/entrypoint.sh b/cfssl/entrypoint.sh new file mode 100644 index 0000000..ee61d97 --- /dev/null +++ b/cfssl/entrypoint.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +if [ ! -f csr_server.json ] || [ ! -f config_server.json ]; then + echo "no csr_server.json or config_server.json detected!"; +fi; +while [ ! -f csr_server.json ] || [ ! -f config_server.json ]; do + sleep 1; +done; + +if [ ! -f ca-key.pem ] +then + cfssl genkey -initca=true csr_server.json | cfssljson -bare ca; +fi + +cfssl serve -address=0.0.0.0 -ca-key ca-key.pem -ca ca.pem -config config_server.json \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 02aecfa..d381bde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: restart: always volumes: - nextcloud:/var/www/html + - ./cfssl:/cfssl environment: - POSTGRES_HOST=db - REDIS_HOST=redis @@ -81,6 +82,14 @@ services: - proxy-tier depends_on: - proxy + cfssl: + image: cfssl/cfssl + volumes: + - ./cfssl:/cfssl + working_dir: /cfssl + entrypoint: /bin/bash + command: + - /cfssl/entrypoint.sh volumes: db: nextcloud: