Advertise filters param in discovery doc.
[arvados.git] / doc / install / install-api-server.html.md.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install the API server
5 navorder: 1
6 ...
7
8 {% include 'alert_stub' %}
9
10 # API server setup
11
12 ## Prerequisites
13
14 1. A GNU/linux (virtual) machine
15 2. A domain name for your api server
16
17 ## Download the source tree
18
19 Please follow the instructions on the [Download page](https://arvados.org/projects/arvados/wiki/Download) in the wiki.
20
21 ## Configure the API server
22
23 First install the gems:
24
25     cd arvados/services/api
26     bundle install
27
28 Next, configure the database:
29
30     cp config/database.yml.sample config/database.yml
31
32 Edit database.yml to your liking and make sure the database and db user exist.
33 Then set up the database:
34  
35     RAILS_ENV=production rake db:setup
36
37 Then set up omniauth:
38
39     cp config/initializers/omniauth.rb.example config/initializers/omniauth.rb
40
41 Edit config/initializers/omniauth.rb. Choose an *APP_SECRET* and *APP_ID*. Also set
42 *CUSTOM_PROVIDER_URL*.
43
44 Make sure your Omniauth provider knows about your *APP_ID* and *APP_SECRET*
45 combination.
46
47 You also need to update config/initializers/secret_token.rb. Generate a new secret with
48
49     rake secret
50
51 and put it in config/initializers/secret_token.rb:
52
53     Server::Application.config.secret_token = 'your-new-secret-here'
54
55 Finally, edit the main configuration:
56
57     cp config/environments/production.rb.example config/environments/production.rb
58
59 First, you want to make sure that 
60
61     config.uuid_prefix
62
63 is set to a unique 5-digit hex string. You can replace the 'cfi-aws-0' string
64 with a string of your choice to make that happen.
65
66 The *config.uuid_prefix* string is a unique identifier for your API server. It
67 also serves as the first part of the hostname for your API server, for instance
68
69     {{ site.arvados_api_host }}
70
71 You should use your own domain instead of arvadosapi.com
72
73 Second, unless you are running on AWS, you will want to change the definition of
74
75     config.compute_node_nameservers
76
77 If you know your nameservers and they are fixed, you can hardcode them, and
78 make sure to remove the code that tries to look them up from the AWS metadata:
79
80     config.compute_node_nameservers = ['1.2.3.4','2.3.4.5','3.4.5.6']
81     #require 'net/http'
82     #config.compute_node_nameservers = ['local', 'public'].collect do |iface|
83     #  Net::HTTP.get(URI("http://169.254.169.254/latest/meta-data/#{iface}-ipv4")).match(/^[\d\.]+$/)[0]
84     #end << '172.16.0.23'
85
86 ## Apache/Passenger
87
88 Set up Apache and Passenger. Point them to the services/api directory in the source tree.
89
90 To enable streaming so users can monitor crunch jobs in real time, add
91 to your Apache configuration:
92
93     PassengerBufferResponse off
94
95 ## Add an admin user
96
97 Point browser to the API endpoint. Log in with a google account.
98
99 In the rails console:
100
101     Thread.current[:user] = User.find(1)
102     Thread.current[:user].is_admin = true
103     User.find(1).update_attributes is_admin: true, is_active: true
104     User.find(1).is_admin
105
106 This should be
107
108      => true
109
110 ## Create a token
111
112 In rails console
113
114      a = ApiClient.new(owner_uuid:'0'); a.save!
115      x = ApiClientAuthorization.new(api_client_id:a.id, user_id:1); x.save; x.api_token
116