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_USER=${POSTGRES_USER}
- 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:
- backend
@ -929,14 +937,15 @@ services:
redis['enable'] = false
nginx['listen_https'] = false
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
gitlab_rails['trusted_proxies'] = ['caddy','nginx','apache2']
gitlab_rails['redis_host'] = 'redis'
gitlab_rails['redis_database'] = 8
gitlab_rails['db_host'] = 'postgres'
gitlab_rails['db_username'] = 'laradock_gitlab'
gitlab_rails['db_password'] = 'laradock_gitlab'
gitlab_rails['db_database'] = 'laradock_gitlab'
gitlab_rails['db_host'] = '${GITLAB_POSTGRES_HOST}'
gitlab_rails['db_username'] = '${GITLAB_POSTGRES_USER}'
gitlab_rails['db_password'] = '${GITLAB_POSTGRES_PASSWORD}'
gitlab_rails['db_database'] = '${GITLAB_POSTGRES_DB}'
gitlab_rails['initial_root_password'] = '${GITLAB_ROOT_PASSWORD}'
gitlab_rails['gitlab_shell_ssh_port'] = ${GITLAB_HOST_SSH_PORT}
volumes:
@ -955,11 +964,14 @@ services:
gitlab-runner:
image: gitlab/gitlab-runner:latest
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:
- ${DATA_PATH_HOST}/gitlab/runner:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock:rw
restart: always
### JupyterHub #########################################
jupyterhub:
@ -968,7 +980,6 @@ services:
depends_on:
- postgres
- jupyterhub-user
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
- ${DATA_PATH_HOST}/jupyterhub/:/data
@ -989,7 +1000,8 @@ services:
- JUPYTERHUB_OAUTH_CALLBACK_URL=${JUPYTERHUB_OAUTH_CALLBACK_URL}
- JUPYTERHUB_OAUTH_CLIENT_ID=${JUPYTERHUB_OAUTH_CLIENT_ID}
- 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:
build:
context: ./jupyterhub
@ -1039,9 +1051,10 @@ services:
networks:
- backend
### PHPRedisAdmin ################################################
phpredisadmin:
image: erikdubbelboer/phpredisadmin:latest
### REDISWEBUI ################################################
redis-webui:
build:
context: ./redis-webui
environment:
- ADMIN_USER=${REDIS_WEBUI_USERNAME}
- ADMIN_PASS=${REDIS_WEBUI_PASSWORD}
@ -1058,7 +1071,6 @@ services:
mongo-webui:
build:
context: ./mongo-webui
restart: always
environment:
- ROOT_URL=${MONGO_WEBUI_ROOT_URL}
- MONGO_URL=${MONGO_WEBUI_MONGO_URL}

View File

@ -500,14 +500,25 @@ SOLR_DATAIMPORTHANDLER_MYSQL=false
SOLR_DATAIMPORTHANDLER_MSSQL=false
### GITLAB ###############################################
GITLAB_POSTGRES_INIT=true
GITLAB_HOST_HTTP_PORT=8989
GITLAB_HOST_HTTPS_PORT=9898
GITLAB_HOST_SSH_PORT=2289
GITLAB_DOMAIN_NAME=http://localhost
GITLAB_ROOT_PASSWORD=laradock
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_POSTGRES_INIT=true
JUPYTERHUB_POSTGRES_HOST=postgres
JUPYTERHUB_POSTGRES_USER=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_CLIENT_ID={GITHUB_CLIENT_ID}
JUPYTERHUB_OAUTH_CLIENT_SECRET={GITHUB_CLIENT_SECRET}
JUPYTERHUB_LOCAL_NOTEBOOK_IMAGE=laradock_jupyterhub-user
JUPYTERHUB_CUSTOM_CONFIG=./jupyterhub/jupyterhub_config.py
JUPYTERHUB_USER_DATA=/jupyterhub
JUPYTERHUB_USER_LIST=./jupyterhub/userlist
JUPYTERHUB_ENABLE_NVIDIA=false
### IPYTHON ##################################################
LARADOCK_IPYTHON_CONTROLLER_IP=127.0.0.1
@ -527,7 +538,7 @@ LARADOCK_IPYTHON_CONTROLLER_IP=127.0.0.1
### NETDATA ###############################################
NETDATA_PORT=19999
### PHPREDISADMIN #########################################
### REDISWEBUI #########################################
REDIS_WEBUI_USERNAME=laradock
REDIS_WEBUI_PASSWORD=laradock
REDIS_WEBUI_CONNECT_HOST=redis

View File

@ -5,3 +5,5 @@ LABEL maintainer="ahkui <ahkui@outlook.com>"
USER root
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_SECRET ${JUPYTERHUB_OAUTH_CLIENT_SECRET}
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 -

View File

@ -6,6 +6,9 @@ import os
c = get_config()
# create system users that don't exist yet
c.LocalAuthenticator.create_system_users = True
def create_dir_hook(spawner):
username = spawner.user.name # get the 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.network_name = network_name
enable_nvidia = os.environ.get('JUPYTERHUB_ENABLE_NVIDIA','false')
# Pass the network name as argument to spawned containers
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"] }
# 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

View File

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

View File

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