server side of the comment service
Switch branches/tags
release-20171122 release-2017-12-11 release-2016-11-03 release-2016-09-15 release-2016-08-03 release-2016-06-06 release-2016-04-14 release-2016-01-27 release-2015-11-09 open-release/hawthorn.2 open-release/hawthorn.1 open-release/hawthorn.1rc3 open-release/hawthorn.1rc2 open-release/hawthorn.1rc1 open-release/ginkgo.2 open-release/ginkgo.1 open-release/ginkgo.1rc1 open-release/ficus.4 open-release/ficus.3 open-release/ficus.2 open-release/ficus.1 open-release/ficus.1rc4 open-release/ficus.1rc3 open-release/ficus.1rc2 open-release/ficus.1rc1 open-release/eucalyptus.3 open-release/eucalyptus.2 open-release/eucalyptus.1 open-release/eucalyptus.1rc2 open-release/eucalyptus/1rc1 nedbat/test/h.1.1 nedbat/test/ficus.4.4 nedbat/test/ficus.4.3 nedbat/test/ficus.4.2 nedbat/test/ficus.3.3 nedbat/test/ficus.3.2 nedbat/test/ficus.3.1 nedbat/test/ficus.2.3 nedbat/test/ficus.2.1 nedbat/test/ficus.2rc1.2 nedbat/test/ficus.2rc1.1 nedbat/test/ficus.1rc4.3 nedbat/test/ficus.1rc4.2 nedbat/test/ficus.1rc4.1 nedbat/test-ficus.1rc4 ned/test-ficus.2 ned/test-ficus.1 named-release/dogwood.3 named-release/dogwood.2 named-release/dogwood.1 named-release/dogwood named-release/dogwood.rc3 named-release/dogwood.rc2 named-release/dogwood.rc1 named-release/cypress named-release/cypress.rc4 named-release/cypress.rc3 named-release/cypress.rc2 named-release/birch.2 named-release/birch.1 named-release/birch named-release/birch.rc3 named-release/birch.rc2 named-release/birch.rc1 named-release/aspen before-sort-preference aspen.1
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis
.tx
api Blank out comment thread documents as well as comment documents. May 15, 2018
bin Added binstubs Jan 6, 2016
config TLS for forums + NR agent update + ignore heartbeat May 17, 2018
edx_specs Remove email from User model and API May 2, 2014
lib
locale Add a default response size and a response size limit. Nov 3, 2016
models
presenters
scripts
spec
.gitignore EDUCATOR-313: Bump ruby to 2.4.1; Use latest newrelic_rpm package; Ad… Jul 26, 2017
.ruby-gemset
.travis.yml EDUCATOR-313: Bump ruby to 2.4.1; Use latest newrelic_rpm package; Ad… Jul 26, 2017
AUTHORS Add Clinton Blackburn as an author Dec 30, 2015
CHANGELOG.rst
Gemfile
Gemfile.lock
Guardfile
LICENSE.txt clarify LICENSE Jul 10, 2013
Procfile fix unicorn defaults; keep using old version of config in Procfile Feb 21, 2014
README.rst
Rakefile Adjust and add search rake tasks. Feb 9, 2017
app.rb
config.ru fix May 17, 2018
openedx.yaml

README.rst

Part of edX code.

edX Comments Service/Forums Travis Codecov

An independent comment system which supports voting and nested comments. It also supports features including instructor endorsement for education-aimed discussion platforms.

Getting Started

If you are running cs_comments_service as part of edx-platform development under devstack, it is strongly recommended to read those setup documents first. Note that devstack will take care of just about all of the installation, configuration, and service management on your behalf. If running outside of devstack, continue reading below.

This service relies on Elasticsearch and MongoDB. By default the service will use the Elasticsearch server available at http://localhost:9200 and the MongoDB server available at localhost:27017. This is suitable for local development; however, if you wish to change these values, refer to config/application.yml and config/mongoid.yml for the environment variables that can be set to override the defaults.

Install the requisite gems:

$ bundle install

To initialize the index:

Setup the search index. Note that the command below creates an alias with a unique name (e.g. content_20161220185820323), and assigns it a known alias: content. If you choose not to use the command below, you should still opt to reference your index by an alias rather than the actual index name. This will enable you to swap out indices (e.g. rebuild_index) without having to take downtime or modify code with a new index name.

$ bin/rake search:initialize

To validate the 'content' alias exists and contains the proper mappings:

$ bin/rake search:validate_index

To rebuild the index:

To rebuild a new index from the database and then point the alias 'content' to it, you can use the rebuild_index task. This task will also run catchup before and after the alias is moved, to minimize time where the alias does not contain all documents.

$ bin/rake search:rebuild_index

To rebuild a new index without moving the alias and without running catchup, use the following:

$ bin/rake search:rebuild_index[false]

You can also adjust the batch size (e.g. 200) and the sleep time (e.g. 2 seconds) between batches to lighten the load on MongoDB.

$ bin/rake search:rebuild_index[true,200,2]

Run the server:

$ ruby app.rb

By default Sinatra runs on port 4567. If you'd like to use a different port pass the -p parameter:

$ ruby app.rb -p 5678

Running Tests

Tests are built using the rspec framework, and can be run with the command below:

$ bin/rspec

If you'd like to view additional options for the command, append the --help option:

$ bin/rspec --help

Running Tests with Docker

You can also use docker-compose to run your tests as follows (assuming you have docker-compose installed):

$ docker-compose -f .travis/docker-compose-travis.yml run --rm test-forum

Internationalization (i18n) and Localization (l10n)

To run the comments service in a language other than English, set the SERVICE_LANGUAGE environment variable to the language code for the desired language. Its default value is en-US.

Setting the language has no effect on user content stored by the service. However, there are a few data validation messages that may be seen by end users via the frontend in edx-platform. These will be translated to SERVICE_LANGUAGE assuming a suitable translation file is found in the locale/ directory.

edX uses Transifex to host translations. To use the Transifex client, be sure it is installed (pip install transifex-client will do this for you), and follow the instructions here to set up your .transifexrc file.

To upload strings to Transifex for translation when you change the set of translatable strings: bin/rake i18n:push

To fetch the latest translations from Transifex: bin/rake i18n:pull

The repository includes some translations so they will be available upon deployment. To commit an update to these: bin/rake i18n:commit

License

The code in this repository is licensed under version 3 of the AGPL unless otherwise noted.

Please see LICENSE.txt for details.

How to Contribute

Contributions are very welcome. The easiest way is to fork this repo, and then make a pull request from your fork. The first time you make a pull request, you may be asked to sign a Contributor Agreement.

Reporting Security Issues

Please do not report security issues in public. Please email security@edx.org

Mailing List and IRC Channel

You can discuss this code on the edx-code Google Group or in the edx-code IRC channel on Freenode.