Commit b60853b4 authored by BLANCHET Christophe's avatar BLANCHET Christophe
Browse files

App data of external images erased by docker volume mount

parent 15899d2f
......@@ -30,20 +30,24 @@ export SERVICE_PORT="3838"
APP_USERNAME="myshiny"
APP_PASSWORD_LOCAL=$( openssl rand -hex 12 )
APP_PASSWORD=${APP_ADMIN_PASSWORD-$APP_PASSWORD_LOCAL} # Usually defined in 'profile.d/ifb.sh'
APP_DATA="$IFB_MAIN/shinyapps"
if [[ "$APP_IMG" == *"rocker/"* ]]; then
SHINY_APP="$IFB_MAIN/shinyapp"
SHINY_LOG="$IFB_MAIN/shinylog"
fi
# Run environment
docker-compose up -d
docker-compose up -d --quiet-pull
# Install shiny app files (external or pre-defined examples)
if [[ "$APP_IMG" == *"rocker/"* ]]; then
if [ -z "$SHINY_REPO" ]; then
# Add shiny pre-defined examples
echo "Adding examples removed by the Docker volume mount"
docker-compose exec -T shiny sh -c "cp -a /usr/local/lib/R/site-library/shiny/examples /srv/shiny-server/"
docker-compose exec -T shiny sh -c "cp -a /opt/shiny-server/samples/* /srv/shiny-server/; ln -s /srv/shiny-server/welcome.html /srv/shiny-server/index.html;"
sed -i "s|/srv/shiny-server|$APP_DATA|g" $APP_DATA/index.html
sed -i "s|/var/log/shiny-server.log|$APP_LOG/|g" $APP_DATA/index.html
sed -i "s|/srv/shiny-server|$SHINY_APP|g" $SHINY_APP/index.html
sed -i "s|/var/log/shiny-server.log|$SHINY_LOG/|g" $SHINY_APP/index.html
else
# Install external Shiny app from repo
echo "Install external Shiny app from repo"
......@@ -51,9 +55,9 @@ if [[ "$APP_IMG" == *"rocker/"* ]]; then
mkdir -p $SHINY_ARCH
git clone $SHINY_REPO $SHINY_ARCH
SHINY_REPODIR=${SHINY_REPODIR:-.}
rm -r $APP_DATA/*
cp -a $SHINY_ARCH/$SHINY_REPODIR/* $APP_DATA/
cp -a sysdeps.sh $APP_DATA/
rm -r $SHINY_APP/*
cp -a $SHINY_ARCH/$SHINY_REPODIR/* $SHINY_APP/
cp -a sysdeps.sh $SHINY_APP/
docker-compose exec -T shiny bash /srv/shiny-server/sysdeps.sh /srv/shiny-server/apt.txt
docker-compose exec -T shiny Rscript /srv/shiny-server/install.R
fi
......@@ -62,4 +66,3 @@ fi
# Set service URLs
APP_URL_SERVICE="[HTTPS]https://$INSTANCE_HOSTNAME,[APP_LOGIN]$APP_USERNAME,[APP_PASSWORD]$APP_PASSWORD"
#ss-set ss:url.service $APP_URL_SERVICE # outsourced
......@@ -10,10 +10,14 @@ services:
- "traefik.http.routers.shiny.service=shiny@docker"
- "traefik.http.services.shiny.loadbalancer.server.port=${SERVICE_PORT:-3838}"
volumes:
- "${IFB_MAIN}/shinylog:/var/log/shiny-server"
- "${IFB_MAIN}/shinyapps:/srv/shiny-server"
- "${SHINY_APP:-shinyapp}:/srv/shiny-server"
- "${SHINY_LOG:-shinylog}:/var/log/shiny-server"
networks:
default:
external: true
name: "${APP_DOCKER_NETWORK:-biosphernet}"
volumes:
shinyapp:
shinylog:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment