Skip to content

Instantly share code, notes, and snippets.

@ngobach
Last active November 25, 2016 19:32
Show Gist options
  • Save ngobach/bc6a3efbb0c27d78e0c72b3882a1a1ba to your computer and use it in GitHub Desktop.
Save ngobach/bc6a3efbb0c27d78e0c72b3882a1a1ba to your computer and use it in GitHub Desktop.

Ubuntu 14.04 and CMS v 1.2

Download at

wget "https://github.com/cms-dev/cms/releases/download/v1.2.0/v1.2.0.tar.gz"

Pre requirements

sudo apt-get install build-essential fpc postgresql postgresql-client \
     gettext python2.7 python-setuptools python-tornado python-psycopg2 \
     python-sqlalchemy python-psutil python-netifaces python-crypto \
     python-tz python-six iso-codes shared-mime-info stl-manual \
     python-beautifulsoup python-mechanize python-coverage python-mock \
     cgroup-lite python-requests python-werkzeug python-gevent patool

Python requirements

sudo pip install -r REQUIREMENTS.txt

Re config file at ./config/*

  • Remove printing service
  • Change default port
  • Change secret_key

Installing

./setup.py build
sudo ./setup.py install

Config postgresql

sudo su - postgres
createuser cmsuser -P
createdb -O cmsuser database
psql database -c 'ALTER SCHEMA public OWNER TO cmsuser'
psql database -c 'GRANT SELECT ON pg_largeobject TO cmsuser'

Install Nginx & config proxy Pass

Use htpasswd to generate password file at /etc/nginx/.htpasswd.

sudo htpasswd -b /etc/nginx/.htpasswd admin p4ssw0rd

File /etc/nginx/sites-available/default

location /rank/ {
		proxy_pass http://127.0.0.1:8081/;
		proxy_set_header Connection '';
		proxy_http_version 1.1;
		chunked_transfer_encoding off;
}
location /admin/ {
		auth_basic "Restricted";
		auth_basic_user_file /etc/nginx/.htpasswd;
		proxy_pass http://127.0.0.1:9000/;
}
location / {
		proxy_pass http://127.0.0.1:8080/;
}

Running contest

File start.sh

#!/bin/sh
cmsRankingWebServer -d
cmsLogService 0 &
cmsRankingWebServer &
cmsResourceService -a 1 && fg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment