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
--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
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
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
./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
# 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
./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
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
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
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.
- https://github.com/TheBunyip/discourse-allow-same-origin (XFrame Option Allow)
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/www/discourse -R
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
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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/gdpelican/babble.git
- git clone https://github.com/gdpelican/retort.git
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 :
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";
}
}