Update document and fix some container bug (#1785)

This commit is contained in:
ahkui 2019-02-09 19:37:11 +08:00 committed by Shao Yu-Lung (Allen)
parent f6c5aa1801
commit 5edf3f398b
8 changed files with 77 additions and 35 deletions

View File

@ -386,6 +386,14 @@ services:
- POSTGRES_DB=${POSTGRES_DB} - POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER} - POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- GITLAB_POSTGRES_INIT=${GITLAB_POSTGRES_INIT}
- GITLAB_POSTGRES_USER=${GITLAB_POSTGRES_USER}
- GITLAB_POSTGRES_PASSWORD=${GITLAB_POSTGRES_PASSWORD}
- GITLAB_POSTGRES_DB=${GITLAB_POSTGRES_DB}
- JUPYTERHUB_POSTGRES_INIT=${JUPYTERHUB_POSTGRES_INIT}
- JUPYTERHUB_POSTGRES_USER=${JUPYTERHUB_POSTGRES_USER}
- JUPYTERHUB_POSTGRES_PASSWORD=${JUPYTERHUB_POSTGRES_PASSWORD}
- JUPYTERHUB_POSTGRES_DB=${JUPYTERHUB_POSTGRES_DB}
networks: networks:
- backend - backend
@ -929,14 +937,15 @@ services:
redis['enable'] = false redis['enable'] = false
nginx['listen_https'] = false nginx['listen_https'] = false
nginx['listen_port'] = 80 nginx['listen_port'] = 80
nginx['custom_gitlab_server_config'] = "set_real_ip_from 172.0.0.0/8;\nreal_ip_header X-Real-IP;\nreal_ip_recursive on;"
postgresql['enable'] = false postgresql['enable'] = false
gitlab_rails['trusted_proxies'] = ['caddy','nginx','apache2'] gitlab_rails['trusted_proxies'] = ['caddy','nginx','apache2']
gitlab_rails['redis_host'] = 'redis' gitlab_rails['redis_host'] = 'redis'
gitlab_rails['redis_database'] = 8 gitlab_rails['redis_database'] = 8
gitlab_rails['db_host'] = 'postgres' gitlab_rails['db_host'] = '${GITLAB_POSTGRES_HOST}'
gitlab_rails['db_username'] = 'laradock_gitlab' gitlab_rails['db_username'] = '${GITLAB_POSTGRES_USER}'
gitlab_rails['db_password'] = 'laradock_gitlab' gitlab_rails['db_password'] = '${GITLAB_POSTGRES_PASSWORD}'
gitlab_rails['db_database'] = 'laradock_gitlab' gitlab_rails['db_database'] = '${GITLAB_POSTGRES_DB}'
gitlab_rails['initial_root_password'] = '${GITLAB_ROOT_PASSWORD}' gitlab_rails['initial_root_password'] = '${GITLAB_ROOT_PASSWORD}'
gitlab_rails['gitlab_shell_ssh_port'] = ${GITLAB_HOST_SSH_PORT} gitlab_rails['gitlab_shell_ssh_port'] = ${GITLAB_HOST_SSH_PORT}
volumes: volumes:
@ -955,11 +964,14 @@ services:
gitlab-runner: gitlab-runner:
image: gitlab/gitlab-runner:latest image: gitlab/gitlab-runner:latest
environment: environment:
- CI_SERVER_URL=${GITLAB_DOMAIN_NAME} - CI_SERVER_URL=${GITLAB_CI_SERVER_URL}
- REGISTRATION_TOKEN=${GITLAB_RUNNER_REGISTRATION_TOKEN}
- RUNNER_NAME=${COMPOSE_PROJECT_NAME}-runner
- REGISTER_NON_INTERACTIVE=${GITLAB_REGISTER_NON_INTERACTIVE}
- RUNNER_EXECUTOR=shell
volumes: volumes:
- ${DATA_PATH_HOST}/gitlab/runner:/etc/gitlab-runner - ${DATA_PATH_HOST}/gitlab/runner:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock:rw - /var/run/docker.sock:/var/run/docker.sock:rw
restart: always
### JupyterHub ######################################### ### JupyterHub #########################################
jupyterhub: jupyterhub:
@ -968,7 +980,6 @@ services:
depends_on: depends_on:
- postgres - postgres
- jupyterhub-user - jupyterhub-user
restart: always
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw - /var/run/docker.sock:/var/run/docker.sock:rw
- ${DATA_PATH_HOST}/jupyterhub/:/data - ${DATA_PATH_HOST}/jupyterhub/:/data
@ -989,7 +1000,8 @@ services:
- JUPYTERHUB_OAUTH_CALLBACK_URL=${JUPYTERHUB_OAUTH_CALLBACK_URL} - JUPYTERHUB_OAUTH_CALLBACK_URL=${JUPYTERHUB_OAUTH_CALLBACK_URL}
- JUPYTERHUB_OAUTH_CLIENT_ID=${JUPYTERHUB_OAUTH_CLIENT_ID} - JUPYTERHUB_OAUTH_CLIENT_ID=${JUPYTERHUB_OAUTH_CLIENT_ID}
- JUPYTERHUB_OAUTH_CLIENT_SECRET=${JUPYTERHUB_OAUTH_CLIENT_SECRET} - JUPYTERHUB_OAUTH_CLIENT_SECRET=${JUPYTERHUB_OAUTH_CLIENT_SECRET}
- JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE=${JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE} - JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE=${COMPOSE_PROJECT_NAME}_jupyterhub-user
- JUPYTERHUB_ENABLE_NVIDIA=${JUPYTERHUB_ENABLE_NVIDIA}
jupyterhub-user: jupyterhub-user:
build: build:
context: ./jupyterhub context: ./jupyterhub
@ -1039,9 +1051,10 @@ services:
networks: networks:
- backend - backend
### PHPRedisAdmin ################################################ ### REDISWEBUI ################################################
phpredisadmin: redis-webui:
image: erikdubbelboer/phpredisadmin:latest build:
context: ./redis-webui
environment: environment:
- ADMIN_USER=${REDIS_WEBUI_USERNAME} - ADMIN_USER=${REDIS_WEBUI_USERNAME}
- ADMIN_PASS=${REDIS_WEBUI_PASSWORD} - ADMIN_PASS=${REDIS_WEBUI_PASSWORD}
@ -1058,7 +1071,6 @@ services:
mongo-webui: mongo-webui:
build: build:
context: ./mongo-webui context: ./mongo-webui
restart: always
environment: environment:
- ROOT_URL=${MONGO_WEBUI_ROOT_URL} - ROOT_URL=${MONGO_WEBUI_ROOT_URL}
- MONGO_URL=${MONGO_WEBUI_MONGO_URL} - MONGO_URL=${MONGO_WEBUI_MONGO_URL}

View File

@ -500,14 +500,25 @@ SOLR_DATAIMPORTHANDLER_MYSQL=false
SOLR_DATAIMPORTHANDLER_MSSQL=false SOLR_DATAIMPORTHANDLER_MSSQL=false
### GITLAB ############################################### ### GITLAB ###############################################
GITLAB_POSTGRES_INIT=true
GITLAB_HOST_HTTP_PORT=8989 GITLAB_HOST_HTTP_PORT=8989
GITLAB_HOST_HTTPS_PORT=9898 GITLAB_HOST_HTTPS_PORT=9898
GITLAB_HOST_SSH_PORT=2289 GITLAB_HOST_SSH_PORT=2289
GITLAB_DOMAIN_NAME=http://localhost GITLAB_DOMAIN_NAME=http://localhost
GITLAB_ROOT_PASSWORD=laradock GITLAB_ROOT_PASSWORD=laradock
GITLAB_HOST_LOG_PATH=./logs/gitlab GITLAB_HOST_LOG_PATH=./logs/gitlab
GITLAB_POSTGRES_HOST=postgres
GITLAB_POSTGRES_USER=laradock_gitlab
GITLAB_POSTGRES_PASSWORD=laradock_gitlab
GITLAB_POSTGRES_DB=laradock_gitlab
### GITLAB-RUNNER ###############################################
GITLAB_CI_SERVER_URL=http://localhost:8989
GITLAB_RUNNER_REGISTRATION_TOKEN=<my-registration-token>
GITLAB_REGISTER_NON_INTERACTIVE=true
### JUPYTERHUB ############################################### ### JUPYTERHUB ###############################################
JUPYTERHUB_POSTGRES_INIT=true
JUPYTERHUB_POSTGRES_HOST=postgres JUPYTERHUB_POSTGRES_HOST=postgres
JUPYTERHUB_POSTGRES_USER=laradock_jupyterhub JUPYTERHUB_POSTGRES_USER=laradock_jupyterhub
JUPYTERHUB_POSTGRES_PASSWORD=laradock_jupyterhub JUPYTERHUB_POSTGRES_PASSWORD=laradock_jupyterhub
@ -516,10 +527,10 @@ JUPYTERHUB_PORT=9991
JUPYTERHUB_OAUTH_CALLBACK_URL=http://laradock:9991/hub/oauth_callback JUPYTERHUB_OAUTH_CALLBACK_URL=http://laradock:9991/hub/oauth_callback
JUPYTERHUB_OAUTH_CLIENT_ID={GITHUB_CLIENT_ID} JUPYTERHUB_OAUTH_CLIENT_ID={GITHUB_CLIENT_ID}
JUPYTERHUB_OAUTH_CLIENT_SECRET={GITHUB_CLIENT_SECRET} JUPYTERHUB_OAUTH_CLIENT_SECRET={GITHUB_CLIENT_SECRET}
JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE=laradock_jupyterhub-user
JUPYTERHUB_CUSTOM_CONFIG=./jupyterhub/jupyterhub_config.py JUPYTERHUB_CUSTOM_CONFIG=./jupyterhub/jupyterhub_config.py
JUPYTERHUB_USER_DATA=/jupyterhub JUPYTERHUB_USER_DATA=/jupyterhub
JUPYTERHUB_USER_LIST=./jupyterhub/userlist JUPYTERHUB_USER_LIST=./jupyterhub/userlist
JUPYTERHUB_ENABLE_NVIDIA=false
### IPYTHON ################################################## ### IPYTHON ##################################################
LARADOCK_IPYTHON_CONTROLLER_IP=127.0.0.1 LARADOCK_IPYTHON_CONTROLLER_IP=127.0.0.1
@ -527,7 +538,7 @@ LARADOCK_IPYTHON_CONTROLLER_IP=127.0.0.1
### NETDATA ############################################### ### NETDATA ###############################################
NETDATA_PORT=19999 NETDATA_PORT=19999
### PHPREDISADMIN ######################################### ### REDISWEBUI #########################################
REDIS_WEBUI_USERNAME=laradock REDIS_WEBUI_USERNAME=laradock
REDIS_WEBUI_PASSWORD=laradock REDIS_WEBUI_PASSWORD=laradock
REDIS_WEBUI_CONNECT_HOST=redis REDIS_WEBUI_CONNECT_HOST=redis

View File

@ -5,3 +5,5 @@ LABEL maintainer="ahkui <ahkui@outlook.com>"
USER root USER root
RUN echo 'fs.inotify.max_user_watches=524288' >> /etc/sysctl.conf RUN echo 'fs.inotify.max_user_watches=524288' >> /etc/sysctl.conf
USER theia

View File

@ -10,6 +10,7 @@ ENV JUPYTERHUB_OAUTH_CALLBACK_URL ${JUPYTERHUB_OAUTH_CALLBACK_URL}
ENV JUPYTERHUB_OAUTH_CLIENT_ID ${JUPYTERHUB_OAUTH_CLIENT_ID} ENV JUPYTERHUB_OAUTH_CLIENT_ID ${JUPYTERHUB_OAUTH_CLIENT_ID}
ENV JUPYTERHUB_OAUTH_CLIENT_SECRET ${JUPYTERHUB_OAUTH_CLIENT_SECRET} ENV JUPYTERHUB_OAUTH_CLIENT_SECRET ${JUPYTERHUB_OAUTH_CLIENT_SECRET}
ENV JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE ${JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE} ENV JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE ${JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE}
ENV JUPYTERHUB_ENABLE_NVIDIA ${JUPYTERHUB_ENABLE_NVIDIA}
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -

View File

@ -6,6 +6,9 @@ import os
c = get_config() c = get_config()
# create system users that don't exist yet
c.LocalAuthenticator.create_system_users = True
def create_dir_hook(spawner): def create_dir_hook(spawner):
username = spawner.user.name # get the username username = spawner.user.name # get the username
volume_path = os.path.join('/user-data', username) volume_path = os.path.join('/user-data', username)
@ -45,8 +48,12 @@ network_name = os.environ.get('JUPYTERHUB_NETWORK_NAME','laradock_backend')
c.DockerSpawner.use_internal_ip = True c.DockerSpawner.use_internal_ip = True
c.DockerSpawner.network_name = network_name c.DockerSpawner.network_name = network_name
enable_nvidia = os.environ.get('JUPYTERHUB_ENABLE_NVIDIA','false')
# Pass the network name as argument to spawned containers # Pass the network name as argument to spawned containers
c.DockerSpawner.extra_host_config = { 'network_mode': network_name, 'runtime': 'nvidia' } c.DockerSpawner.extra_host_config = { 'network_mode': network_name }
if 'true' == enable_nvidia:
c.DockerSpawner.extra_host_config = { 'network_mode': network_name, 'runtime': 'nvidia' }
pass
# c.DockerSpawner.extra_host_config = { 'network_mode': network_name, "devices":["/dev/nvidiactl","/dev/nvidia-uvm","/dev/nvidia0"] } # c.DockerSpawner.extra_host_config = { 'network_mode': network_name, "devices":["/dev/nvidiactl","/dev/nvidia-uvm","/dev/nvidia0"] }
# Explicitly set notebook directory because we'll be mounting a host volume to # Explicitly set notebook directory because we'll be mounting a host volume to
# it. Most jupyter/docker-stacks *-notebook images run the Notebook server as # it. Most jupyter/docker-stacks *-notebook images run the Notebook server as

View File

@ -33,9 +33,12 @@
# EOSQL # EOSQL
# #
### default database and user for gitlab ############################################## ### default database and user for gitlab ##############################################
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL if [ "$GITLAB_POSTGRES_INIT" == 'true' ]; then
CREATE USER laradock_gitlab WITH PASSWORD 'laradock_gitlab'; psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE laradock_gitlab; CREATE USER $GITLAB_POSTGRES_USER WITH PASSWORD '$GITLAB_POSTGRES_PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE laradock_gitlab TO laradock_gitlab; CREATE DATABASE $GITLAB_POSTGRES_DB;
ALTER ROLE laradock_gitlab CREATEROLE SUPERUSER; GRANT ALL PRIVILEGES ON DATABASE $GITLAB_POSTGRES_DB TO $GITLAB_POSTGRES_USER;
EOSQL ALTER ROLE $GITLAB_POSTGRES_USER CREATEROLE SUPERUSER;
EOSQL
echo
fi

View File

@ -33,9 +33,12 @@
# EOSQL # EOSQL
# #
### default database and user for jupyterhub ############################################## ### default database and user for jupyterhub ##############################################
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL if [ $JUPYTERHUB_POSTGRES_INIT == 'true' ]; then
CREATE USER laradock_jupyterhub WITH PASSWORD 'laradock_jupyterhub'; psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE laradock_jupyterhub; CREATE USER $JUPYTERHUB_POSTGRES_USER WITH PASSWORD '$JUPYTERHUB_POSTGRES_PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE laradock_jupyterhub TO laradock_jupyterhub; CREATE DATABASE $JUPYTERHUB_POSTGRES_DB;
ALTER ROLE laradock_jupyterhub CREATEROLE SUPERUSER; GRANT ALL PRIVILEGES ON DATABASE $JUPYTERHUB_POSTGRES_DB TO $JUPYTERHUB_POSTGRES_USER;
EOSQL ALTER ROLE $JUPYTERHUB_POSTGRES_USER CREATEROLE SUPERUSER;
EOSQL
echo
fi

3
redis-webui/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM erikdubbelboer/phpredisadmin
LABEL maintainer="ahkui <ahkui@outlook.com>"