Current build status:
master: PENDING
- Ruby 2.4.1
- PostgreSQL >= 9.4
- Bundler (
gem install bundler) - Node
- Etherpad
wget https://github.com/ether/etherpad-lite/archive/1.6.1.tar.gztar -zxvf 1.6.1.tar.gzrm 1.6.1.tar.gzmv etherpad-lite-1.6.1 etherpadcd etherpad/srcnpm installcd ..npm install ep_fileupload ep_copy_paste_images ep_previewimages ep_embedded_hyperlinks ep_document_import_hook ep_import_documents_images ep_markdown ep_export_cp_html_image ep_font_size ep_desktop_notifications ep_special_characters ep_foot_note ep_automatic_logutcp -R etherpad_plugins/ep_gv_insert_image etherpad/node_modules/ep_gv_insert_imagecd ..echo "test-api-key" > ./etherpad/APIKEY.txtcp config/etherpad.json.example ./etherpad/settings.json- customize
./etherpad/settings.jsonas needed- Add your domain to enable the custom plugin
"ep_gv_insert_image": {"domains": ["http://localhost:3000"]}
- Add your domain to enable the custom plugin
- Make sure python 2.7.x is installed
- Run
pip install -r bias-detector/requirements.txt - Run
python -m nltk.downloader all
If you face issue while installing libraries, you may have to run pip tool using sudo privileges.
To test bias detector, go to bias-detector/bsd/bsdetector and type python newsframe.py "hello world". If it works, your bias detector installation is working fine.
-
cp .env.example .env -
customize
.env -
ETHERPAD_URLshould point to the root of the Etherpad server (no path) -
ETHERPAD_API_KEYshould be the same as the contents of./etherpad/APIKEY.txt -
bundle install -
bundle exec rake db:create -
bundle exec rake db:schema:load -
bundle exec rake db:seed
./etherpad/bin/run.shbundle exec rails server
bundle exec rake spec
One-time server setup:
- create and customize environment as needed (edit
~/.rbenv/vars)
Deploy application (staging):
bundle exec cap staging deploy
Once the application code is deployed, you can control the processes (see config/god.rb) with:
bundle exec cap staging server:startbundle exec cap staging server:restartbundle exec cap staging server:stop
We have continuous integration enabled using Circle CI. Builds are created, tests are run for every checkin in every branch. Staging build is deployed when master or develop is updated.
Etherpad deployment:
- Follow the "Etherpad setup" instructions above but generate a real, random API key
- Configure
settings.jsonto use Postgres - Patch the following issue in one of Etherpad's depencencies: ether/etherpad-lite#3128 ether/ueberDB#93
rm -rf ./etherpad/src/node_modules/ueberdb2/node_modules/pg- edit
./etherpad/src/node_modules/ueberdb2/package.jsonand bump thepgversion to6.1.5 - from
./etherpad/src, runnpm install
- Start Etherpad server with
./etherpad/bin/run.sh
Deploy application (production):
Server is configured using ansible playbook. See ansible/README.md
Once server is configured, change nginx cache permissions as following. You would need sudo access to do it.
chown -R www-data:www-data /var/cache/nginx
Running (production):
To control server from your local machine, type:
bundle exec cap production server:startbundle exec cap production server:restartbundle exec cap production server:stop
To control server after ssh, preferred approach is to use systemctl if configured, but you can also use:
bundle exec god -c config/god.rbbundle exec god terminate
To start etherpad, you have to ssh. Preferred approach is to use systemctl if configured, but you can also use:
nohup ./etherpad/bin/run.sh &
To stop etherpad, you have to ssh. Preferred approach is to use systemctl if configured, else, you have to find the process id and kill it.
Autostart app (production)
We use 2 systemd scripts to start app processes when machine is rebooted - scripts/newsframes.service and scripts/etherpad.service. These are not deployed using ansible and should be done manually in /etc/systemd/system. If the system does not support systemd, init.d scripts will have to be written specifically.
Once the scripts have been deployed, the following commands can be used to run the scripts on machine boot:
sudo systemctl enable newsframes.servicesudo systemctl enable etherpad.service
The following commands can be used to control these services:
sudo systemctl status newsframes.servicesudo systemctl status etherpad.servicesudo systemctl start newsframes.servicesudo systemctl start etherpad.servicesudo systemctl stop newsframes.servicesudo systemctl stop etherpad.servicesudo systemctl restart newsframes.servicesudo systemctl restart etherpad.servicesudo journalctl restart -u newsframes.service -fsudo journalctl restart -u etherpad.service -f
To create an admin, run (without <>)
bundle exec rake admin:invite_admin name=<name here> email=<email here>
If an existing user is to be made admin, just use the email parameter.