diff --git a/docker-compose-for-prod/.auth b/docker-compose-for-prod/.auth new file mode 100644 index 0000000000000000000000000000000000000000..bcd69386037a476419c2663db13f4543483cb8d0 --- /dev/null +++ b/docker-compose-for-prod/.auth @@ -0,0 +1,2 @@ +DEPLOY_USER=my-user +DEPLOY_TOKEN=not-secured-password \ No newline at end of file diff --git a/docker-compose-for-prod/.env b/docker-compose-for-prod/.env new file mode 100644 index 0000000000000000000000000000000000000000..17f4ba9fc36726527b9f4d0a640bb5cc3dc3a88f --- /dev/null +++ b/docker-compose-for-prod/.env @@ -0,0 +1,4 @@ +CI_PROJECT_NAMESPACE=ada-team +CI_PROJECT_NAME=my-project +CI_REGISTRY=registry-gitlab.pasteur.fr +PROD_BRANCH=main diff --git a/docker-compose-for-prod/.example.env b/docker-compose-for-prod/.example.env new file mode 100644 index 0000000000000000000000000000000000000000..f81812ae8b100b24db3ac3e6d62621fdbf1c3626 --- /dev/null +++ b/docker-compose-for-prod/.example.env @@ -0,0 +1,4 @@ +CI_PROJECT_NAMESPACE=hub +CI_PROJECT_NAME=shiny-k8s-example +CI_REGISTRY=registry-gitlab.pasteur.fr +PROD_BRANCH=base-python diff --git a/docker-compose-for-prod/README.md b/docker-compose-for-prod/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d1fa2103b47f717bc45d2c2bb68ecf57e19a8bb2 --- /dev/null +++ b/docker-compose-for-prod/README.md @@ -0,0 +1,43 @@ +# Running in production with docker compose + +Documentation can be found at https://hub.pages.pasteur.fr/shiny-k8s/user_guide/run_with_compose.html + +## Configure your .env + +In the `.env` file we provide example to run the compose : + +Given a project hosted at # If your project is hosted at https://gitlab.pasteur.fr/ada-team/my-project/ +where the production branch is named `main`, the file is: +```ini +CI_PROJECT_NAMESPACE=ada-team +CI_PROJECT_NAME=my-project +CI_REGISTRY=registry-gitlab.pasteur.fr +PROD_BRANCH=main +``` + +## Run it +```sh +docker compose up -d +``` + +## Run the example +```sh +docker compose --env-file .example.env up +``` + +## With private registry + +You have to auth before starting the compose. Given a .auth file containing : +```ini +DEPLOY_USER=my-user +DEPLOY_TOKEN=not-secured-password +``` +You should then do: +```sh +source .auth +source .env +echo $DEPLOY_TOKEN | docker login --username $DEPLOY_USER $CI_REGISTRY --password-stdin +docker compose up -d +``` + +more info can be found at https://docs.docker.com/reference/cli/docker/login/#password-stdin \ No newline at end of file diff --git a/docker-compose-for-prod/docker-compose.yaml b/docker-compose-for-prod/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..840650cea48502532fe942448bd7fc9202bd418c --- /dev/null +++ b/docker-compose-for-prod/docker-compose.yaml @@ -0,0 +1,12 @@ +services: + shiny-server: + image: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/${PROD_BRANCH}:latest + pull_policy: always + user: 'shiny:shiny' + volumes: + - ./my_project:/srv/shiny-server/ + - ./logs:/var/log/shiny-server + - ./persistent:/srv/shiny-server/www/persistent + - ./data:/srv/shiny-server/data + ports: + - '3838:3838' \ No newline at end of file