Take a run at bootstrapping this

This commit is contained in:
decentral1se 2021-05-17 15:54:59 +02:00
parent ff6f96fc76
commit 0b7873871a
No known key found for this signature in database
GPG Key ID: 92DAD76BD9567B8A
5 changed files with 79 additions and 20 deletions

View File

@ -1,6 +1,6 @@
TYPE=rstudio
DOMAIN=rstudio.example.com
## Domain aliases
#EXTRA_DOMAINS=', `www.rstudio.example.com`'
LETS_ENCRYPT_ENV=production
SECRET_ADMIN_PASSWORD_VERSION=v1

View File

@ -1,16 +1,22 @@
# Rstudio
# rstudio
An integrated development environment for R and Python, with a console, syntax-highlighting editor that supports direct code execution, and tools for plotting, history, debugging and workspace management.
> https://www.rocker-project.org/images
An integrated development environment for R and Python, with a console,
syntax-highlighting editor that supports direct code execution, and tools for
plotting, history, debugging and workspace management.
<!-- metadata -->
* **Category**:
* **Status**:
* **Image**: [`rstudio`](https://hub.docker.com/r/rstudio/rstudio)
* **Healthcheck**:
* **Backups**:
* **Email**:
* **Tests**:
* **SSO**:
- **Category**:
- **Status**:
- **Image**: [`rocker/tidyverse`](https://hub.docker.com/r/rocker/tidyverse)
- **Healthcheck**:
- **Backups**:
- **Email**:
- **Tests**:
- **SSO**:
<!-- endmetadata -->
## Basic usage

1
abra.sh Normal file
View File

@ -0,0 +1 @@
export CUSTOM_ENTRYPOINT_VERSION=v1

View File

@ -3,29 +3,54 @@ version: "3.8"
services:
app:
image: nginx:1.19.2
image: rocker/tidyverse:4.0.4
networks:
- proxy
volumes:
- home:/home
secrets:
- admin_password
environment:
- ROOT=TRUE
- PASSWORD_FILE=/run/secrets/admin_password
configs:
- source: custom_entrypoint
target: /usr/local/bin/docker-entrypoint.sh
mode: 0555
entrypoint: /usr/local/bin/docker-entrypoint.sh
command: /init
deploy:
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8787"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
entrypoint:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
test:
["CMD-SHELL", "wget -q --spider --proxy=off localhost:8787 || exit 1"]
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
volumes:
home:
networks:
proxy:
external: true
configs:
custom_entrypoint:
name: ${STACK_NAME}_custom_entrypoint_${CUSTOM_ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl
secrets:
admin_password:
name: ${STACK_NAME}_admin_password_${SECRET_ADMIN_PASSWORD_VERSION}
external: true

27
entrypoint.sh.tmpl Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env "PASSWORD"