#oauth #github #machines #user #env #set #client

nightly app clowder

Software to manage user-reserved bare-metal netbooting machines

4 releases

Uses old Rust 2015

0.3.0 Aug 29, 2018
0.2.9 Nov 9, 2017
0.2.8 Nov 8, 2017
0.2.7 Nov 8, 2017

#787 in Authentication

Apache-2.0 OR MIT

1.5MB
5K SLoC

Rust 2.5K SLoC // 0.0% comments JavaScript 2.5K SLoC // 0.1% comments SQL 147 SLoC // 0.1% comments

Clowder on crates.io Clowder on travis-ci.org

Getting started

GitHub

Clowder uses OAuth for authentication, with the current provider being GitHub. At your local site, you need to create a GitHub OAuth application with your own Client ID and Client Secret. Set up environment variables containing these values, or put them in a .env file in your source directory:

echo "CLOWDER_GH_CLIENT_ID=aaaaaaaaaa" > .env
echo "CLOWDER_GH_CLIENT_SECRET=aaaaaaaaaa" >> .env

Rust

For the moment, we depend on crates that depend on Rust nightly (see SergioBenitez/Rocket#19 for our main blocker). You will likely want to use Rustup to install the nightly version of Rust.

Database

Clowder requires a database to be created that is accessible to the user running the service. Using Postgres (at least on FreeBSD), this looks like:

# service postgresql initdb
# service postgresql start
# su - postgres
$ createuser ${username}    # with a username like, e.g., clowder
$ psql postgres
postgres=# create database clowder;
postgres=# grant all on database clowder to ${username};

You should set the database URL in an environment variable, or in a .env file within your source directory:

$ echo "export DATABASE_URL=postgres://localhost/clowder" >> .env

Once the database has been created, we use the Diesel ORM to initialize it:

$ cargo install diesel_cli
$ cd path/to/clowder/source
$ diesel migration run

Clowder

Once Rust and the Clowder database have been set up, you can build and run Clowder!

$ cargo build
$ cargo run

Development environment

Fake user account

You can set CLOWDER_FAKE_GITHUB_USERNAME in your environment (or .env file) to provide a username to be treated as if it were obtained from the normal GitHub OAuth workflow.

Reloading

For development purposes, I like to use cargo-watch to rebuild whenever I change a source file:

$ cargo watch --ignore '*.swp' --exec run

This goes quite nicely with LiveReload.

Dependencies

~22–32MB
~589K SLoC