Skip to content

HART Setup

Richly edited this page May 21, 2019 · 14 revisions

This page will try to give you a complete overview on how to setup HART. This setup is written for UNIXoid systems, Windows is currently not supported.

General Setup

  1. Clone the HART repository git clone https://github.com/hpi-swt2/vm-portal.git

Create the first admin

By default, every user that logs in the first time, its role will be User. But for changing other users roles, we need to have an admin. Therefore, we need to create the first Admin.

  1. Open the rails console in the production environment rails console -e production
  2. Get the user you want to appoint as an admin by typing user = User.find_by_email("<E-mail address>")
  3. Make him an admin user.role="admin"
  4. And save it by typing user.save! (this might take some time)
    • If you have not yet set up Git, a few errors regarding git will be printed when you execute this command. Don't worry, your command will still execute and set the admin role correctly.
  5. Now exit the console via exit and you have your first admin.

Setup Git(Hub)

In order to have HART working with Git (let it store its Puppet files in the Git), follow these steps

  1. Create a GitHub user you want to use to perform the pushes.
  2. For this user create a repository on GitHub you want to use to store your Puppet files in.
  3. Add a SSH-Key following this example. The E-Mail has to be the one of the GitHub user, which will perform the pushes to the repository in the end.
    Save the key in ~/.ssh/id_rsa_<GitHub username> and make sure not to enter a passphrase.
  4. Add the key to the key agent and your GitHub account following these instructions
  5. Edit or create a ssh config file at ~/.ssh/config containing the following:
Host github.com-<GitHub username>
   HostName github.com
   User git
   ServerAliveInterval 30
   ServerAliveCountMax 120
   IdentityFile ~/.ssh/id_rsa_<GitHub username>
  1. git clone [email protected]<GitHub username>:<Repository owner>/<Repository name>.git once to make sure it works, and to add it to your trusted ssh hosts. You can remove the cloned folder afterward.
  2. Open up HART and enter the Git settings which can be found here: /app_settings/1/edit (Admins only, therefore create the first admin first). They have to look as following:
  • Repository URL: [email protected]<GitHub username>:<Repository owner>/<Repository name>.git
  • Repository Name: <Repository name>
  • Git Branch: should be master, but you can also define another one
  • Github Username: <GitHub username>
  • Github User E-Mail: <Github user e-mail>

Setup HPI OpenID Connect

To enable the user authentification via HPI OpenID Connect, the following steps are necessary. The configuration of the Devise gem for the communication with the OpenID service is done in config/initializers/devise.rb.

  1. Register a new client on https://oidc.hpi.de. The redirect uri must have the following schema: <url>/users/auth/hpi/callback
  2. Execute EDITOR=vim rails credentials:edit in the root folder of the application to edit the encrypted credentials
  3. Add the following information:
hpi_openid:
  client_id: <client_id>
  client_secret: <secret> 
  redirect_uri: <base_url>/users/auth/hpi/callback
Clone this wiki locally