From eab812b63d777f6b8f50992140a724a0995b71c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Wed, 26 Dec 2018 18:43:00 +0100 Subject: [PATCH] Move portainer to a dedicated make command Portainer is no longer a global activation flag, because it does not make much sense in the context of kubernetes. Instead, we use a simpler "make" command. --- build/configurator/bin/configurator | 2 -- deploy/local/Makefile | 8 +++++ deploy/local/templates/docker-compose.yml | 12 -------- deploy/templates/letsencrypt/certonly.sh | 4 --- deploy/templates/nginx/extra.conf | 36 ----------------------- docs/local.rst | 16 ++++++++++ docs/options.rst | 10 ------- docs/troubleshooting.rst | 2 ++ 8 files changed, 26 insertions(+), 64 deletions(-) diff --git a/build/configurator/bin/configurator b/build/configurator/bin/configurator index adbf8f6..bc7fe04 100755 --- a/build/configurator/bin/configurator +++ b/build/configurator/bin/configurator @@ -173,8 +173,6 @@ def interactive_configuration(config_path): 'ACTIVATE_HTTPS', False, "Activate SSL/TLS certificates for HTTPS access? Important note: this will NOT work in a development environment.", ).add_bool( 'ACTIVATE_NOTES', False, "Activate Student Notes service (https://open.edx.org/features/student-notes)?", - ).add_bool( - 'ACTIVATE_PORTAINER', False, "Activate Portainer, a convenient Docker dashboard with a web UI (https://portainer.io)?", ).add_bool( 'ACTIVATE_XQUEUE', False, "Activate Xqueue for external grader services? (https://github.com/edx/xqueue)", ).add( diff --git a/deploy/local/Makefile b/deploy/local/Makefile index 533a191..2993a3c 100644 --- a/deploy/local/Makefile +++ b/deploy/local/Makefile @@ -168,6 +168,14 @@ import-demo-course: ## Import the demo course from edX create-staff-user: ## Create a user with admin rights $(DOCKER_COMPOSE_RUN_OPENEDX) lms /bin/bash -c "./manage.py lms manage_user --superuser --staff ${USERNAME} ${EMAIL} && ./manage.py lms changepassword ${USERNAME}" +portainer: ## Run Portainer (https://portainer.io), a UI for container supervision + docker run --rm -it \ + --volume=/var/run/docker.sock:/var/run/docker.sock \ + --volume=$(PWD)/../../data/portainer:/data \ + -p 9000:9000 \ + portainer/portainer:latest + @echo "View the Portainer UI at http://localhost:9000" + ##################### Information # Obtained by running "echo '\033' in a shell diff --git a/deploy/local/templates/docker-compose.yml b/deploy/local/templates/docker-compose.yml index f4539b3..2fe43bc 100644 --- a/deploy/local/templates/docker-compose.yml +++ b/deploy/local/templates/docker-compose.yml @@ -187,15 +187,3 @@ services: depends_on: - mysql {% endif %} - - {% if ACTIVATE_PORTAINER %} - ############# Portainer: container supervision with a web UI - portainer: - image: portainer/portainer:latest - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ../../data/portainer:/data - restart: unless-stopped - depends_on: - - nginx - {% endif %} diff --git a/deploy/templates/letsencrypt/certonly.sh b/deploy/templates/letsencrypt/certonly.sh index 3568ea5..750b69a 100755 --- a/deploy/templates/letsencrypt/certonly.sh +++ b/deploy/templates/letsencrypt/certonly.sh @@ -4,7 +4,3 @@ certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d {{ LMS_H {% if ACTIVATE_NOTES %} certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d notes.{{ LMS_HOST }} {% endif %} - -{% if ACTIVATE_PORTAINER %} -certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d portainer.{{ LMS_HOST }} -{% endif %} diff --git a/deploy/templates/nginx/extra.conf b/deploy/templates/nginx/extra.conf index 22b4a34..b6c33c1 100644 --- a/deploy/templates/nginx/extra.conf +++ b/deploy/templates/nginx/extra.conf @@ -33,39 +33,3 @@ server { } } {% endif %} - -{% if ACTIVATE_PORTAINER %} -{% if ACTIVATE_HTTPS %} -server { - server_name portainer.{{ LMS_HOST }}; - listen 80; - return 301 https://$server_name$request_uri; -} -{% endif %} - -server { - listen {{ "443 ssl" if ACTIVATE_HTTPS else "80" }}; - server_name portainer.localhost portainer.{{ LMS_HOST }}; - - {% if ACTIVATE_HTTPS %} - ssl_certificate /etc/letsencrypt/live/portainer.{{ LMS_HOST }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/portainer.{{ LMS_HOST }}/privkey.pem; - {% endif %} - - # Disables server version feedback on pages and in headers - server_tokens off; - - location / { - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_redirect off; - - # Docker resolver - resolver 127.0.0.11 valid=10s; - set $upstream portainer; - proxy_pass http://$upstream:9000; - } -} -{% endif %} diff --git a/docs/local.rst b/docs/local.rst index 1d3e5af..f69d92c 100644 --- a/docs/local.rst +++ b/docs/local.rst @@ -96,6 +96,22 @@ The course search index can be updated with:: Run this command periodically to ensure that course search results are always up-to-date. +.. _portainer: + +Docker container web UI with `Portainer `_ +----------------------------------------------------------------- + +Portainer is a web UI for managing docker containers. It lets you view your entire Open edX platform at a glace. Try it! It's really cool:: + + make portainer + +.. .. image:: https://portainer.io/images/screenshots/portainer.gif + ..:alt: Portainer demo + +After launching your platfom, the web UI will be available at `http://localhost:9000 `_. You will be asked to define a password for the admin user. Then, select a "Local environment" to work on and hit "Connect" and select the "local" group to view all running containers. + +Among many other things, you'll be able to view the logs for each container, which is really useful. + Additional commands ------------------- diff --git a/docs/options.rst b/docs/options.rst index 170a009..72d8d84 100644 --- a/docs/options.rst +++ b/docs/options.rst @@ -41,16 +41,6 @@ Xqueue `Xqueue `_ is for grading problems with external services. If you don't know what it is, you probably don't need it. -Docker container web UI with `Portainer `_ ------------------------------------------------------------------ - -Portainer is a web UI for managing docker containers. It lets you view your entire Open edX platform at a glace. Try it! It's really cool. - -.. image:: https://portainer.io/images/screenshots/portainer.gif - :alt: Portainer demo - -After launching your platfom, the web UI will be available at `http://portainer.localhost `_ and http://portainer.YOUR_LMS_HOST. You will be asked to define a password for the admin user. Then, select a "Local environment" to work on and hit "Connect". You're done! Select the "local" group to view all running containers. Amon many other things, you'll be able to view the logs for each container, which is really useful. - Android app (beta) ------------------ diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index cc3a553..ce5359a 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -27,6 +27,8 @@ The last commands produce the logs since the creation of the containers, which c docker-compose logs --tail=0 -f +If you'd rather use a graphical user interface for viewing logs, you are encouraged to try out :ref:`Portainer `. + "Cannot start service nginx: driver failed programming external connectivity" -----------------------------------------------------------------------------