X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/56b07eaa6ad92b04d31098913632a397c4aa62d5..6d2128ae15825ef03472897e09710b176e3cc1d9:/doc/install/install-api-server.html.textile.liquid diff --git a/doc/install/install-api-server.html.textile.liquid b/doc/install/install-api-server.html.textile.liquid index 13b82a3d00..a1cca3d8b4 100644 --- a/doc/install/install-api-server.html.textile.liquid +++ b/doc/install/install-api-server.html.textile.liquid @@ -9,15 +9,15 @@ h2. Prerequisites: # A GNU/Linux (virtual) machine # A domain name for your api server -h2. Install dependencies +h2(#dependencies). Install dependencies
~$ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev \
     libxslt1.1 zlib1g-dev gettext bison libssl-dev libreadline-dev \
-    libpq-dev sqlite3 libsqlite3-dev build-essential wget postgresql
+    libpq-dev sqlite3 libsqlite3-dev build-essential wget postgresql sudo
 
-h2. Install Ruby and bundler +h2(#ruby). Install Ruby and bundler We recommend Ruby >= 2.1. @@ -31,7 +31,7 @@ cd ruby-2.1.1 make sudo make install -gem install bundler +sudo gem install bundler h2. Download the source tree @@ -84,13 +84,32 @@ Put it in @config/application.yml@ in the production or common section: Consult @application.default.yml@ for a full list of configuration options. Always put your local configuration in @application.yml@ instead of editing @application.default.yml@. -Configure the database: +Generate a new database password. Nobody ever needs to memorize it or type it, so we'll make a strong one: + + +
~/arvados/services/api$ ruby -e 'puts rand(2**128).to_s(36)'
+6gqa1vu492idd7yca9tfandj3
+
+ +Create a new database user with permission to create its own databases. + + +
~/arvados/services/api$ sudo -u postgres createuser --createdb --encrypted --pwprompt arvados
+[sudo] password for you: yourpassword
+Enter password for new role: paste-password-you-generated
+Enter it again: paste-password-again
+Shall the new role be a superuser? (y/n) n
+Shall the new role be allowed to create more new roles? (y/n) n
+
+ +Configure API server to connect to your database by creating and updating @config/database.yml@. Replace the @xxxxxxxx@ database password placeholders with the new password you generated above.
~/arvados/services/api$ cp -i config/database.yml.sample config/database.yml
+~/arvados/services/api$ edit config/database.yml
 
-By default, the development database will use the sqlite3 driver, so no configuration is necessary. If you wish to use mysql or postgres, edit @config/database.yml@ to your liking and make sure the database and db user exist. Then initialize the database: +Create and initialize the database.
~/arvados/services/api$ RAILS_ENV=development bundle exec rake db:setup
@@ -107,7 +126,7 @@ Edit @config/initializers/omniauth.rb@. Set @APP_SECRET@ to the value of @app_se
 You can now run the development server:
 
 
-
~/arvados/services/api$ rails server
+
~/arvados/services/api$ bundle exec rails server --port=3030
 
h3. Apache/Passenger (optional) @@ -123,28 +142,22 @@ To enable streaming so users can monitor crunch jobs in real time, add to your P h2. Add an admin user -Point browser to the API endpoint. Log in with a google account. - -In the rails console: +Point your browser to the API server's login endpoint: -
~/arvados/services/api$ rails console
-irb(main):001:0> Thread.current[:user] = User.find(1)
-irb(main):002:0> Thread.current[:user].is_admin = true
-irb(main):003:0> User.find(1).update_attributes is_admin: true, is_active: true
-irb(main):004:0> User.find(1).is_admin
-=> true
-
+
https://localhost:3030/login
+
+ -h2. Create an API token +Log in with your google account. -In rails console: +Use the rails console to give yourself admin privileges: -
~/arvados/services/api$ rails console
-irb(main):001:0> a = ApiClient.new(owner_uuid:'0')
-irb(main):002:0> a.save!
-irb(main):003:0> x = ApiClientAuthorization.new(api_client_id:a.id, user_id:1)
-irb(main):004:0> x.save
-irb(main):005:0> x.api_token
+
~/arvados/services/api$ bundle exec rails console
+irb(main):001:0> Thread.current[:user] = User.all.select(&:identity_url).last
+irb(main):002:0> Thread.current[:user].is_admin = true
+irb(main):003:0> Thread.current[:user].update_attributes is_admin: true, is_active: true
+irb(main):004:0> User.where(is_admin: true).collect &:email
+=> ["root", "your_address@example.com"]