6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-05 12:57:52 +00:00

🤡 Activate discussion forums

This commit is contained in:
Régis Behmo 2018-05-27 07:30:23 -04:00
parent f37702fc8d
commit f5a407cae7
11 changed files with 101 additions and 26 deletions

View File

@ -1,17 +1,17 @@
.PHONY: all configure build update migrate assets up daemon
USERID ?= $$(id -u)
DOCKER_COMPOSE_RUN = docker-compose run --rm -e USERID=$(USERID)
EDX_PLATFORM_SETTINGS ?= universal.production
DOCKER_COMPOSE_RUN += -e SETTINGS=$(EDX_PLATFORM_SETTINGS)
DOCKER_COMPOSE_RUN = docker-compose run --rm
DOCKER_COMPOSE_RUN_OPENEDX = $(DOCKER_COMPOSE_RUN) -e USERID=$(USERID) -e SETTINGS=$(EDX_PLATFORM_SETTINGS)
ifneq ($(EDX_PLATFORM_PATH),)
DOCKER_COMPOSE_RUN += --volume="$(EDX_PLATFORM_PATH):/openedx/edx-platform"
DOCKER_COMPOSE_RUN_OPENEDX += --volume="$(EDX_PLATFORM_PATH):/openedx/edx-platform"
endif
DOCKER_COMPOSE_RUN_LMS = $(DOCKER_COMPOSE_RUN) -p 8000:8000 lms
DOCKER_COMPOSE_RUN_CMS = $(DOCKER_COMPOSE_RUN) -p 8001:8001 cms
DOCKER_COMPOSE_RUN_LMS = $(DOCKER_COMPOSE_RUN_OPENEDX) -p 8000:8000 lms
DOCKER_COMPOSE_RUN_CMS = $(DOCKER_COMPOSE_RUN_OPENEDX) -p 8001:8001 cms
all: configure update migrate assets daemon
all: configure update migrate migrate-forum assets daemon
##################### Bootstrapping
@ -22,12 +22,16 @@ update:
docker-compose pull
migrate:
$(DOCKER_COMPOSE_RUN) lms bash -c "wait-for-greenlight.sh && ./manage.py lms migrate"
$(DOCKER_COMPOSE_RUN) cms bash -c "wait-for-greenlight.sh && ./manage.py cms migrate"
$(DOCKER_COMPOSE_RUN_OPENEDX) lms bash -c "wait-for-greenlight.sh && ./manage.py lms migrate"
$(DOCKER_COMPOSE_RUN_OPENEDX) cms bash -c "wait-for-greenlight.sh && ./manage.py cms migrate"
migrate-forum:
$(DOCKER_COMPOSE_RUN) forum bash -c "bundle exec rake search:initialize && \
bundle exec rake search:rebuild_index"
assets:
$(DOCKER_COMPOSE_RUN) lms paver update_assets lms --settings=$(EDX_PLATFORM_SETTINGS)
$(DOCKER_COMPOSE_RUN) cms paver update_assets cms --settings=$(EDX_PLATFORM_SETTINGS)
$(DOCKER_COMPOSE_RUN_OPENEDX) lms paver update_assets lms --settings=$(EDX_PLATFORM_SETTINGS)
$(DOCKER_COMPOSE_RUN_OPENEDX) cms paver update_assets cms --settings=$(EDX_PLATFORM_SETTINGS)
##################### Running
@ -44,10 +48,10 @@ stop:
##################### Extra
import-demo-course:
$(DOCKER_COMPOSE_RUN) cms /bin/bash -c "git clone https://github.com/edx/edx-demo-course ../edx-demo-course && git -C ../edx-demo-course checkout open-release/ginkgo.master && python ./manage.py cms import ../data ../edx-demo-course"
$(DOCKER_COMPOSE_RUN_OPENEDX) cms /bin/bash -c "git clone https://github.com/edx/edx-demo-course ../edx-demo-course && git -C ../edx-demo-course checkout open-release/ginkgo.master && python ./manage.py cms import ../data ../edx-demo-course"
create-staff-user:
$(DOCKER_COMPOSE_RUN) lms /bin/bash -c "./manage.py lms manage_user --superuser --staff ${USERNAME} ${EMAIL} && ./manage.py lms changepassword ${USERNAME}"
$(DOCKER_COMPOSE_RUN_OPENEDX) lms /bin/bash -c "./manage.py lms manage_user --superuser --staff ${USERNAME} ${EMAIL} && ./manage.py lms changepassword ${USERNAME}"
##################### Development
@ -58,18 +62,22 @@ cms:
$(DOCKER_COMPOSE_RUN_CMS) bash
lms-shell:
$(DOCKER_COMPOSE_RUN) lms ./manage.py lms shell
$(DOCKER_COMPOSE_RUN_OPENEDX) lms ./manage.py lms shell
cms-shell:
$(DOCKER_COMPOSE_RUN) cms ./manage.py cms shell
$(DOCKER_COMPOSE_RUN_OPENEDX) cms ./manage.py cms shell
#################### Deploying to docker hub
build:
# We need to build with docker, as long as docker-compose cannot push to dockerhub
docker build -t regis/openedx:latest -t regis/openedx:ginkgo openedx/
docker build -t regis/openedx-forum:latest -t regis/openedx-forum:ginkgo forum/
push:
docker push regis/openedx:ginkgo
docker push regis/openedx:latest
docker push regis/openedx-forum:ginkgo
docker push regis/openedx-forum:latest
dockerhub: build push

View File

@ -50,6 +50,7 @@ You will need to download the docker images from [Docker Hub](https://hub.docker
### Migrations and assets
make migrate
make migrate-forum
make assets
These commands should be run just once. They will create the database tables and generate static assets, such as images, stylesheets and Javascript dependencies.
@ -216,10 +217,6 @@ If you have a problem, feel free to open a [Github issue](https://github.com/reg
## Known missing features
### Forums
Forums are not installed in this proposed install of Open edX. They require a specific ruby install and settings. Unfortunately, there is no section dedicated specifically to the forums in the [Open edX documentation](http://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/open-release-ginkgo.master/).
### SSL certificates
We have decided not to include the installation of SSL certificates in this project for running an Open edX platform on HTTPS. This is because there are too many different ways to generate SSL certificates. In particular, we should not assume that everyone uses [Let's Encrypt](http://letsencrypt.org/) certificates. If you decide to run your Open edX platform behind HTTPS, you will have to modify:
@ -227,6 +224,10 @@ We have decided not to include the installation of SSL certificates in this proj
* the generated nginx configuration files
* the `lms.env.json` and `cms.env.json` files: look for the `LMS_ROOT_URL` and `CMS_ROOT_URL` variables and replace "http" by "https".
### Discovery service, XQueue, edX Notes, Ecommerce, Notifier
Those extra services were considered low priority while developing this project. However, most of them should not be too hard to add to a standard install. If you need one or more of these services, feel free to let me know by opening an issue.
## Contributing
Pull requests will be happily examined! However, we should be careful to keep the project lean and simple: both to use and to modify. Optional features should not make the user experience more complex. Instead, documentation on how to add the feature is preferred.

View File

@ -16,6 +16,10 @@
"CELERY_BROKER_TRANSPORT": "amqp",
"MEDIA_ROOT": "/openedx/data/uploads/",
"STATIC_ROOT_BASE": "/openedx/data/staticfiles",
"ELASTIC_SEARCH_CONFIG": [{
"host": "elasticsearch",
"port": 9200
}],
"EMAIL_BACKEND": "django.core.mail.backends.smtp.EmailBackend",
"EMAIL_HOST": "smtp",
"CACHES": {

View File

@ -14,8 +14,13 @@
"LMS_BASE": "${LMS_HOST}",
"CELERY_BROKER_HOSTNAME": "rabbitmq",
"CELERY_BROKER_TRANSPORT": "amqp",
"COMMENTS_SERVICE_KEY": "forumapikey",
"MEDIA_ROOT": "/openedx/data/uploads/",
"STATIC_ROOT_BASE": "/openedx/data/staticfiles",
"ELASTIC_SEARCH_CONFIG": [{
"host": "elasticsearch",
"port": 9200
}],
"EMAIL_BACKEND": "django.core.mail.backends.smtp.EmailBackend",
"EMAIL_HOST": "smtp",
"CACHES": {

View File

@ -6,9 +6,6 @@ update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
# Set uploaded media file path
MEDIA_ROOT = "/openedx/data/uploads/"
# Deactivate forums
FEATURES['ENABLE_DISCUSSION_SERVICE'] = False
# Activate dev_env for logging, otherwise rsyslog is required (but it is
# not available in docker).
LOGGING = get_logger_config(LOG_DIR,

View File

@ -4,7 +4,6 @@ from ..aws import *
update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
MEDIA_ROOT = "/openedx/data/uploads/"
FEATURES['ENABLE_DISCUSSION_SERVICE'] = False
# We need to activate dev_env for logging, otherwise rsyslog is required (but
# it is not available in docker).

View File

@ -6,9 +6,6 @@ update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
# Set uploaded media file path
MEDIA_ROOT = "/openedx/data/uploads/"
# Deactivate forums
FEATURES['ENABLE_DISCUSSION_SERVICE'] = False
# Activate dev_env for logging, otherwise rsyslog is required (but it is
# not available in docker).
LOGGING = get_logger_config(LOG_DIR,

View File

@ -4,7 +4,6 @@ from ..aws import *
update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
MEDIA_ROOT = "/openedx/data/uploads/"
FEATURES['ENABLE_DISCUSSION_SERVICE'] = False
# We need to activate dev_env for logging, otherwise rsyslog is required (but
# it is not available in docker).

1
data/.gitignore vendored
View File

@ -2,6 +2,7 @@ cms/
cms_worker/
lms/
lms_worker/
elasticsearch/
mysql/
mongodb/
rabbitmq/

View File

@ -29,6 +29,20 @@ services:
MYSQL_PASSWORD_FILE: /etc/mysql/conf.d/openedx/password
MYSQL_ROOT_PASSWORD_FILE: /etc/mysql/conf.d/openedx/password
elasticsearch:
image: elasticsearch:1.5.2
environment:
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "cluster.name=openedx"
- "bootstrap.memory_lock=true"
ulimits:
memlock:
soft: -1
hard: -1
restart: "unless-stopped"
volumes:
- ./data/elasticsearch:/usr/share/elasticsearch/data
nginx:
image: nginx:1.13
restart: unless-stopped
@ -49,6 +63,21 @@ services:
image: namshi/smtp
restart: unless-stopped
############# Forum
forum:
image: regis/openedx-forum:ginkgo
build:
context: ./forum
environment:
API_KEY: "forumapikey"
SEARCH_SERVER: "http://elasticsearch:9200"
MONGOHQ_URL: "mongodb://mongodb/cs_comments_service"
restart: unless-stopped
depends_on:
- elasticsearch
- mongodb
############# LMS and CMS
lms:
@ -62,6 +91,8 @@ services:
- ./config/openedx:/openedx/config
- ./data/lms:/openedx/data
depends_on:
- elasticsearch
- forum
- memcached
- mongodb
- mysql

33
forum/Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM ubuntu:16.04
RUN mkdir /openedx
RUN apt update && \
apt upgrade -y && \
apt install -y git wget autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
# Install ruby-build for building specific version of ruby
RUN git clone https://github.com/sstephenson/ruby-build.git /openedx/ruby-build
WORKDIR /openedx/ruby-build
RUN PREFIX=/usr/local ./install.sh
# Install ruby and some specific dependencies
ENV RUBY_VERSION 1.9.3-p551
ENV BUNDLER_VERSION 1.11.2
ENV RAKE_VERSION 10.4.2
RUN ruby-build $RUBY_VERSION /openedx/ruby
ENV PATH "/openedx/ruby/bin:$PATH"
RUN gem install bundler -v $BUNDLER_VERSION
RUN gem install rake -v $RAKE_VERSION
# gem upgrade must come after bundler/rake install
RUN gem install rubygems-update && update_rubygems
# Install forum
RUN git clone https://github.com/edx/cs_comments_service.git --branch open-release/ginkgo.master --depth 1 /openedx/cs_comments_service
WORKDIR /openedx/cs_comments_service
RUN bundle install --deployment
ENV RACK_ENV staging
ENV NEW_RELIC_ENABLE false
EXPOSE 4567
CMD ./bin/unicorn -c config/unicorn_tcp.rb -I '.'