installs and configures CMS.
These cookbooks are direct dependencies of this cookbook.
- build-essentials (for cms)
- nginx (for cms::proxy)
- htpasswd (for cms::proxy)
- postgresql (for cms::db)
Currently, this cookbook supports only Ubuntu.
node['cms']['services']
- Corresponds tocore_services
andother_services
incms.conf
.node['cms']['contest_server']
- which port to listen onnode['cms']['admin_server']
- which port to listen onnode['cms']['ranking_server']
- which port to listen onnode['cms']['ranking_server_id']
- which of the configuration to use incms.ranking.conf
node['cms']['cmsuser']
- which user to add to the groupcmsuser
node['cms']['db']['password']
- database optionnode['cms']['db']['database']
- database optionnode['cms']['db']['server']
- database option.node['cms']['db']['debug']
- Corresponds todatabase_debug
incms.conf
.node['cms']['twophase_commit']
- Corresponds totwophase_commit
incms.conf
.node['cms']['keep_sandbox']
- whether to keep sandbox in /tmp or deletenode['cms']['tornado_debug']
- whether Tornado prints debug information on stdoutnode['cms']['cookie_duration']
- login cookie duration in secondsnode['cms']['submit_local_copy']
- whether to save submissions to disk before storing them in the DB.node['cms']['submit_local_copy_path']
- the path forsubmit_local_copy
node['cms']['ip_lock']
- whether to use IP lock or notnode['cms']['block_hidden_users']
- whether to block login to hidden usersnode['cms']['is_proxy_used']
- whether ContestWebServer is behind reverse proxy or notnode['cms']['max_submission_length']
- maximum size of a submission in bytesnode['cms']['max_input_length']
- maximum size of an input in bytesnode['cms']['stl_path']
- STL documentation path in the systemnode['cms']['allow_communication']
- whether questions and messages are enablednode['cms']['process_cmdline']
- used for process heartbeat check by ResourceServicenode['cms']['color_shell_log']
- whether to print ANSI color codesnode['cms']['color_file_log']
- whether to print ANSI color codesnode['cms']['color_remote_shell_log']
- whether to print ANSI color codesnode['cms']['color_remote_file_log']
- whether to print ANSI color codesnode['cms']['secret_key']
- used to encode information that can be seen by the usernode['cms']['auth']['auth_types']
- which instruments to use for logging innode['cms']['auth']['twitter_consumer_key']
- Twitter Consumer Key for logging in via Twitternode['cms']['auth']['twitter_consumer_secret']
- Twitter Consumer Secret for logging in via Twitternode['cms']['auth']['facebook_app_id']
- Facebook App ID for logging in via Facebooknode['cms']['auth']['facebook_app_secret']
- Facebook App Secret for logging in via Facebook
node['cms']['git']['repo']
- git repository used incms::git
.node['cms']['git']['ref']
- git branch/tag name used incms::git
.
For example, assume there are three servers:
- 192.168.30.11 - for Web server & DB server, and miscellaneous
- 192.168.30.12 - for Judge server 1
- 192.168.30.13 - for Judge server 2
Write three roles, cms, dbserver and webserver.
roles/cms.json
:
{
"name": "cms",
"json_class": "Chef::Role",
"description": "CMS",
"chef_type": "role",
"run_list" : [
"recipe[cms::git]"
],
"default_attributes": {},
"override_attributes": {
"cms": {
"services": {
"Worker": [
["192.168.30.12", 26000],
["192.168.30.13", 26000]
],
"ResourceService": [
["192.168.30.11", 28000],
["192.168.30.12", 28000],
["192.168.30.13", 28000]
],
"LogService": [["192.168.30.11", 29000]],
"ScoringService": [["192.168.30.11", 28500]],
"Checker": [["192.168.30.11", 22000]],
"EvaluationService": [["192.168.30.11", 25000]],
"ContestWebServer": [["192.168.30.11", 21000]],
"AdminWebServer": [["192.168.30.11", 21100]],
"TestFileCacher": []
},
"is_proxy_used": true,
"contest_server": [{
"host": "192.168.30.11",
"port": 8888
}],
"admin_server": [{
"host": "192.168.30.11",
"port": 8889
}],
"ranking_server": [{
"username": "SOME_ARBITRARY_USERNAME",
"password": "SOME_ARBITRARY_PASSWORD",
"host": "192.168.30.11",
"port": 8890
}],
"cmsuser": ["ubuntu"],
"db": {
"password": "SOME_SECURE_PASSWORD_FOR_CMSDB",
"database": "cmsdb",
"host": "192.168.30.11"
},
"proxy_contest": {
"host": "cms.example.com",
"port": 28888
},
"proxy_ranking": {
"host": "cms.example.com",
"port": 28890
},
"proxy_admin": {
"host": "cms.example.com",
"port": 28889,
"username": "ADMIN_USERNAME",
"password": "ADMIN_PASSWORD"
},
"git": {
"repo": "git://github.com/cms-dev/cms.git",
"ref": "master"
},
"secret_key": "SOME_SECURE_SECRET_KEY",
"auth": {
"auth_types": ["Password", "Twitter", "Facebook"],
"twitter_consumer_key": "TWITTER_CONSUMER_KEY",
"twitter_consumer_secret": "TWITTER_CONSUMER_SECRET",
"facebook_app_id": "FACEBOOK_APP_ID",
"facebook_app_secret": "FACEBOOK_APP_SECRET"
}
}
}
}
There are two ways to fetch CMS:
- cms (cms::default): fetch CMS as a tarball
- cms::git: fetch CMS from a git repository
Also note that auth_types are not available in the current master branch of CMS.
roles/dbserver.json
:
{
"name": "dbserver",
"json_class": "Chef::Role",
"description": "DB Server for CMS",
"chef_type": "role",
"run_list" : [
"role[cms]",
"recipe[cms::db]"
],
"override_attributes": {},
"default_attributes": {
"postgresql": {
"config": {
"listen_addresses": "*"
},
"password": {
"postgres": "SOME_SECURE_PASSWORD_FOR_POSTGRES"
},
"pg_hba": [
{"type": "local", "db": "all", "user": "postgres", "addr": null, "method": "ident"},
{"type": "local", "db": "all", "user": "all", "addr": null, "method": "ident"},
{"type": "host", "db": "all", "user": "all", "addr": "127.0.0.1/32", "method": "md5"},
{"type": "host", "db": "all", "user": "all", "addr": "::1/128", "method": "md5"},
{"type": "host", "db": "cmsdb", "user": "cmsuser", "addr": "0.0.0.0/0", "method": "md5"}
]
}
}
}
roles/dbserver.json
:
{
"name": "webserver",
"default_attributes": {},
"override_attributes": {},
"json_class": "Chef::Role",
"description": "Web Server for CMS",
"chef_type": "role",
"run_list" : [
"role[cms]",
"recipe[cms::proxy]"
]
}
Then write a node.
nodes/192.168.30.11.json
:
{
"run_list": [
"role[dbserver]",
"role[webserver]"
]
}
nodes/192.168.30.12.json
:
{
"run_list": [
"role[cms]"
]
}
nodes/192.168.30.13.json
:
{
"run_list": [
"role[cms]"
]
}
Then cook:
knife solo cook 192.168.30.11
knife solo cook 192.168.30.12
knife solo cook 192.168.30.13
Currently, this cookbook only installs and configures CMS. You have to run CMS by hand.
If you can contribute to this cookbook, fork this repository and pull-req!
License: The Apache License, Version 2.0 Authors: Masaki Hara (ackie.h.gmai@gmail.com)