This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
README.txt
132 lines (87 loc) · 3.68 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
Charon
======
Database for IGN projects and samples, with RESTful interface. Built on
top of Tornado and CouchDB.
API
---
The RESTful API is documented at http://charon.scilifelab.se/apidoc .
Note that each call to the API must include an API token which is the
only mechanism used for authentication in the API. The API token is
specific for the user account, and is available in the user page for the
account.
A number of code examples for using the API can be found in the nosetest
``test_*.py`` files.
The nosetest examples require that the environment variables
CHARON\_API\_TOKEN and CHARON\_BASE\_URL are set.
Design notes
~~~~~~~~~~~~
The API is designed such that all data sent to and received from the
interface is JSON containing pure application data. Metadata, such as
the API access token, is passed as a HTTP header item, so as not to
clutter up the data namespace. This also allows for sending other types
of data as body content, such as images, which cannot contain API access
tokens.
**Tip**: Use the
`requests <http://docs.python-requests.org/en/latest/>`_ package for all
HTTP client code. It is way better than the urllib2 package in the
standard Python distribution.
Development server
------------------
The development server is at http://charon-dev.scilifelab.se/ . It is
currently reachable only from within SciLifeLab Stockholm.
Database wipe every weekend!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please note that the CouchDB databases on tools-dev are all wiped clean
and reloaded from tools every weekend. Since there currently is no data
in the Charon database on tools, the tools-dev Charon instance gets
totally wiped out. Not even the design documents are spared.
To handle this, I currently manually dump and reload the Charon
database, on Friday afternoon and Monday morning, respectively:
::
$ python dump.py
$ python init_database.py # Answer 'y' to the question.
Installation
~~~~~~~~~~~~
The development server is installed as an ordinary Python package in
``/usr/lib/python2.6/site-packages/charon`` . The controlling
configuration file ``tools-dev.yaml`` (which is not part of the GitHub
stuff) is located there. I have set the owner of that directory to
``per.kraulis`` to make it simpler for me...
The development server is upgraded thus:
::
$ pip install --upgrade --no-deps git+https://github.com/NationalGenomicsInfrastructure/charon
The Tornado service is controlled by the upstart script
``/etc/init/charon.conf``.
The Apache server handles the redirect from the domain name to the
Tornado server which runs on port 8881. See
``/etc/httpd/conf/httpd.conf``.
The log file written by the Tornado server currently goes to the install
directory.
Production server
-----------------
The production server is available at http://charon.scilifelab.se/ and
is reachable from outside SciLifeLab to approved accounts, which are set
up using Userman at http://userman.scilifelab.se/ .
The production server is upgraded in a similar way as the development
server.
Service setup
~~~~~~~~~~~~~
The source code used in production is located in:
::
/usr/lib/python2.6/site-packages/charon
The configuration file tools.yaml is located in:
::
/var/local/charon
The log file charon.log is located in:
::
/var/log/charon
The production server is upgraded thus:
::
$ pip install --upgrade --no-deps git+https://github.com/pekrau/charon
The production server is currently started manually by Per Kraulis under
the account genomics.www using the following command:
::
$ cd /usr/lib/python2.6/site-packages/charon
$ sudo -b -u genomics.www python2.6 app_charon.py /var/local/charon/tools.yaml
*Yes, this is awful!* But the /etc/init.d stuff has not been written
yet...