|
| 1 | +moocng |
1 | 2 | ======
|
2 |
| -MoocNG |
3 |
| -====== |
4 | 3 |
|
5 |
| -MoocNG |
| 4 | +These are the configuration steps required for the moocng installation to work. |
| 5 | + |
| 6 | +Create the PostgreSQL database |
| 7 | +------------------------------ |
| 8 | + |
| 9 | +.. code-block:: bash |
| 10 | +
|
| 11 | + $ su - postgres |
| 12 | + $ createuser moocng --no-createrole --no-createdb --no-superuser -P |
| 13 | + Enter password for new role: ***** |
| 14 | + Enter it again: ***** |
| 15 | + $ createdb -E UTF8 --owner=moocng moocng |
| 16 | +
|
| 17 | +Add the new user to the allowed users for that database. For that we need to edit **/var/lib/pgsql/data/pg_hba.conf** and add this line in the first place, before anything: |
| 18 | + |
| 19 | +.. code-block:: ini |
| 20 | +
|
| 21 | + # TYPE DATABASE USER CIDR-ADDRESS METHOD |
| 22 | + local moocng moocng md5 |
| 23 | +
|
| 24 | +Please note: The pg_hba.conf location depends on your distribution, in Ubuntu for example, it is **/etc/postgresql/8.1/main/pg_hba.conf** |
| 25 | + |
| 26 | +Configure rabbitMQ |
| 27 | +------------------ |
| 28 | + |
| 29 | +RabbitMQ is used in OpenMOOC engine to perform some tasks like sending emails and creating the last frames of the videos. First of all you need to install it: |
| 30 | + |
| 31 | +.. code-block:: bash |
| 32 | +
|
| 33 | + # yum install erlang rabbitmq-server |
| 34 | +
|
| 35 | +First, you need to create a user, a password, and a virtual host. You can do it with these commands: |
| 36 | + |
| 37 | +.. code-block:: bash |
| 38 | +
|
| 39 | + $ service rabbitmq-server start |
| 40 | + $ rabbitmqctl add_user rabbitusername rabbitpassword |
| 41 | + $ rabbitmqctl add_vhost yourvirtualhost |
| 42 | + $ rabbitmqctl set_permissions -p username virtualhost ".*" ".*" ".*" |
| 43 | +
|
| 44 | +*Example*: |
| 45 | + |
| 46 | +.. code-block:: bash |
| 47 | +
|
| 48 | + $ service rabbitmq-server start |
| 49 | + $ rabbitmqctl add_user moocng moocngpassword |
| 50 | + $ rabbitmqctl add_vhost moocng |
| 51 | + $ rabbitmqctl set_permissions -p moocng moocng ".*" ".*" ".*" |
| 52 | +
|
| 53 | +You should not need anything else but putting the address of your rabbitMQ server in the settings. Edit your **/etc/openmooc/moocng/moocngsettings/local.py** file and add a connection line to your rabbitMQ server: |
| 54 | + |
| 55 | +.. code-block:: ini |
| 56 | +
|
| 57 | + BROKER_URL = 'amqp://myuser:mypassword@rabbitServerAdress:5672/moocng' |
| 58 | +
|
| 59 | +*Example*: |
| 60 | + |
| 61 | +.. code-block:: ini |
| 62 | +
|
| 63 | + BROKER_URL = 'amqp://moocng:moocngpassword@localhost:5672/moocng' |
| 64 | +
|
| 65 | +Configuring your moocng instance |
| 66 | +-------------------------------- |
| 67 | + |
| 68 | +The configuration files for moocng are located in **/etc/openmooc/moocng/moocngsettings/**. Open your *local.py* file and add this: |
| 69 | + |
| 70 | +.. code-block:: python |
| 71 | +
|
| 72 | + DATABASES = { |
| 73 | + 'default': { |
| 74 | + 'ENGINE': 'django.db.backends.postgresql_psycopg2', |
| 75 | + 'NAME': 'moocng', |
| 76 | + 'USER': 'moocng', |
| 77 | + 'PASSWORD': 'yourmoocngpassword', |
| 78 | + 'HOST': 'localhost', |
| 79 | + 'PORT': '', |
| 80 | + } |
| 81 | + } |
| 82 | +
|
| 83 | +Generate the SECRET_KEY |
| 84 | +....................... |
| 85 | + |
| 86 | +The secret key is a random string that Django uses in several places like the CSRF attack protection. It is considered a security problem if you don't change this value and leave it as the moocng default. You can generate a random value with the following command: |
| 87 | + |
| 88 | +.. code-block:: bash |
| 89 | +
|
| 90 | + $ tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz' </dev/urandom | dd bs=32 count=1 2>/dev/null;echo |
| 91 | +
|
| 92 | +Copy the returning value in your **/etc/openmooc/moocng/moocngsettings/local.py** file, like this: |
| 93 | + |
| 94 | +.. code-block:: python |
| 95 | +
|
| 96 | + SECRET_KEY = "uzy3hc2mtevod229yrsywldgh945cmiu" |
| 97 | +
|
| 98 | +Copy the static files |
| 99 | +..................... |
| 100 | + |
| 101 | +If you will be using the default static and media folders, please skip until the copy part of this section. If you plan to use your own folders follow the full instructions. |
| 102 | + |
| 103 | +The default moocng static and media directories are located in: |
| 104 | + |
| 105 | +.. code-block:: bash |
| 106 | +
|
| 107 | + /var/lib/openmooc/moocng/static |
| 108 | + /var/lib/openmooc/moocng/media |
| 109 | +
|
| 110 | +To change the default directories you must edit your **/etc/openmooc/moocng/moocngsettings/local.py** and add these two settings: |
| 111 | + |
| 112 | +.. code-block:: bash |
| 113 | +
|
| 114 | + MEDIA_ROOT = “path/to/your/media/files/” |
| 115 | + STATIC_ROOT = “path/to/your/static/files/” |
| 116 | +
|
| 117 | +To copy the static files we are going to use the command **moocngadmin**: |
| 118 | + |
| 119 | +.. code-block:: bash |
| 120 | +
|
| 121 | + # moocngadmin collectstatic |
| 122 | +
|
| 123 | +Change the permissions in **/var/lib/openmooc/moocng** so nginx can read the files, and the wsgi can read/write them. |
| 124 | + |
| 125 | +Sync the database and make the migrations |
| 126 | + |
| 127 | +.. code-block:: bash |
| 128 | +
|
| 129 | + # moocngadmin syncdb --migrate |
| 130 | +
|
| 131 | +You’re done! You should be able to run a test instance and visit it with this command: |
| 132 | + |
| 133 | +.. code-block:: bash |
| 134 | +
|
| 135 | + $ moocngadmin runserver 0.0.0.0:8000 |
0 commit comments