Skip to main content

Discourse Integration with Open-edX


Hi, Just need to follow some steps & get discourse running with Open-edX. 😃

Step 1:  install the latest stable Docker. Run the following command inside vagrant shell
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 \
    --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.com/ubuntu docker main \
          > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker
-------------------------------------------------------------------------------------------
Step 2: clone the git repository hosting the Discourse Docker configuration into the /var/discourse directory:
mkdir /var/discourse
cd /var/discourse
git clone https://github.com/discourse/discourse_docker.git
-------------------------------------------------------------------------------------------
Step 3: To configure discourse run following commands:
Cd /var/discourse/discourse_docker.
cp samples/data.yml containers/
cp samples/redis.yml containers/
cp samples/web_only.yml containers/app.yml # Renamed this one
set our database password. Replace "SOME_SECRET" with a password of your own: ‘discourse’
-------------------------------------------------------------------------------------------
Step 4:  Need to edit the replace the following file from container i.e
containers/data.yml
containers/redis.yml
containers/app.yml
Replace with file by downloading from link :

-------------------------------------------------------------------------------------------
Step 5 : To configure discourse ,  Go to path /var/discourse/discourse_docker
Run commands: sudo ./discourse-setup
-------------------------------------------------------------------------------------------
Step 6:  After step5 completion check docker status :
sudo docker ps (it will show all the running container)
sudo docker images(it will show you discourse image created for app, data, redis container)
If docker is not started yet ,  run the following commands :
sudo docker run IMAGE_ID (can see image_id by executing command : sudo docker images)

View the link for more helpful:


Step 7:  Bootstrap and start the three containers by running following commands.

cd /var/discourse/discourse_docker
./launcher bootstrap redis
./launcher bootstrap data

./launcher start redis
./launcher start data

>>> if getting some issue related to postgres , then stop postgresql services.
sudo service postgresql status
sudo service postgresql stop
Start your containers redis, data etc.

>>>When above containers are running, we can bootstrap and start the web container
# This will take longer, the rails app has a long
# build / asset prep process
./launcher bootstrap app
./launcher start app

>>> On Chaning Any Container files need to execute commandS:
./launcher rebuild app
./launcher rebuild redis
            ./launcher rebuild data
To  resides in the container.
You should use ./launcher start app && ./launcher enter app
to access the container filesystem

Step 8: If you curl localhost at port 8080, you should see it run!

curl -I 127.0.0.1:8080

O/P >>>>>>
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 27 Mar 2017 12:11:19 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Discourse-Route: finish_installation/index
Cache-Control: no-store, must-revalidate, no-cache, private
Set-Cookie: _forum_session=TVZUK1BEM1M5dWp0ampHRXhZZFF4eUhXaU1XZVpUdTA1K0pDM0xLb2lhQ0R1Nm1xdVhadzNTTnpGWUV3Rm5VSi9TYXVSeS9jdkpIRUdia0RHQmlqVWc9PS0tSytmTnBlM3hteE12emlkVllxUytYQT09--973b5c9a116d563743df1bc53db3190a796f47ff; path=/; HttpOnly; SameSite=Lax
X-Request-Id: 4cdc6ea8-f762-4074-9c24-feeac99ce994
X-Runtime: 0.264255
X-UA-Compatible: IE=edge
-------------------------------------------------------------------------------------------------------------------------------

Step 9 : Nginx configuration
Installation>>>>>

sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get update
sudo apt-get install -y nginx

Create your Nginx configuration.  Like :  sudo nano /etc/nginx/sites-available/forums.conf

Step 10: Once your configuration is created, remove the default config from sites-enabled, make a symlink, test the config and reload Nginx if it checks out:
# Remove default config
sudo rm /etc/nginx/sites-enabled/default

# Symlink our new config
sudo ln -s /etc/nginx/sites-available/forums.conf \
          /etc/nginx/sites-enabled/forums.conf

# Test configuration
sudo service nginx configtest

# If configtest checks out:
sudo service nginx reload

Step 11: Add the port mapping  in edx Vagrantfile for local accessible.:
   config.vm.network :forwarded_port, guest: 8080, host: 8080  # Discourse

Step12 :

Note: Refer the following links for more info.

sudo apt-get remove docker*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/www/discourse -R



To remove x-frame option error>>>>>>>>>>>>>>
Change in sudo nano /etc/nginx/proxy_params
Add line: proxy_hide_header X-Frame-Options;

>>> Update this in app.yml>>>>>>>>>>>>>>>>>>>>
hooks:
 after_code:
   - exec:
       cd: $home/plugins
       cmd:
         - mkdir -p plugins
         - git clone https://github.com/discourse/docker_manager.git
         - git clone https://github.com/discourse/discourse-spoiler-alert.git
         - git clone https://github.com/TheBunyip/discourse-allow-same-origin.git
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Some Other useful discourse repo>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


To set Cors in discourse.

To debug in docker app
Sudo ./launcher logs app

x-frame-origin-embed-error>>>>>>>>>>>>>>>>>



Social Sign Up Discourse






For Docker:
sudo reboot
uname -r

Edit file /etc/apt/sources.list.d/docker.list and add following
deb https://apt.dockerproject.org/repo ubuntu-precise main


sudo apt-get install docker-engine

sudo apt-get purge docker lxc-docker-1.5.0
sudo apt-get autoremove
sudo apt-get update

Ref:http://allan-simon.github.io/blog/posts/install-docker-on-ubuntu-12.04/



https://meta.discourse.org/t/troubleshooting-email-on-a-new-discourse-install/16326/131

Nginx Configuration:
cd /etc/nginx/sites-available :  discourse :
upstream discourse {
   server 0.0.0.0:8099;
}

server {
   listen 80;

   root /var/www/discourse/public;
   index index.html index.htm;

   access_log /var/log/nginx/forums.serversforhackers.com.log;
   error_log  /var/log/nginx/forums.serversforhackers.com-error.log error;

   server_name _;

   charset utf-8;

   location / {
       include proxy_params;
       proxy_pass http://discourse;

       proxy_redirect off;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
   }
}

Popular posts from this blog

How to read or extract text data from passport using python utility.

Hi ,  Lets get start with some utility which can be really helpful in extracting the text data from passport documents which can be images, pdf.  So instead of jumping to code directly lets understand the MRZ, & how it works basically. MRZ Parser :                 A machine-readable passport (MRP) is a machine-readable travel document (MRTD) with the data on the identity page encoded in optical character recognition format Most travel passports worldwide are MRPs.  It can have 2 lines or 3 lines of machine-readable data. This method allows to process MRZ written in accordance with ICAO Document 9303 (endorsed by the International Organization for Standardization and the International Electrotechnical Commission as ISO/IEC 7501-1)). Some applications will need to be able to scan such data of someway, so one of the easiest methods is to recognize it from an image file. I 'll show you how to retrieve the MRZ information from a picture of a passport using the PassportE

How to generate class diagrams pictures in a Django/Open-edX project from console

A class diagram in the Unified Modeling Language ( UML ) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations (or methods), and the relationships among objects. https://github.com/django-extensions/django-extensions Step 1:   Install django extensions Command:  pip install django-extensions Step 2:  Add to installed apps INSTALLED_APPS = ( ... 'django_extensions' , ... ) Step 3:  Install diagrams generators You have to choose between two diagram generators: Graphviz or Dotplus before using the command or you will get: python manage.py graph_models -a -o myapp_models.png Note:  I prefer to use   pydotplus   as it easier to install than Graphviz and its dependencies so we use   pip install pydotplus . Command:  pip install pydotplus Step 4:  Generate diagrams Now we have everything installed and ready to generate diagrams using the comm

How to Remove course from Open-edX

Go to vagrant  => 1. In the edx-platform directory:  - cd /edx/app/edxapp/edx-platform 2. Run the following Django management command:   - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings aws    - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings=devstack 3. Find the course ID which you'd like to delete in the resulting list of course IDs. 4. Copy the course ID into the following command and run it:  - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms delete_course <COURSE_ID> --settings aws  -   sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms delete_course <COURSE_ID> --settings=devstack  - You'll be asked to verify the deletion . To verify the deletion, run the command from step 2 above and ensure that the course ID is not in the list. Help reference : https://openedx.atlassian.net/wiki/spa