-
Postgres running locally with a user/password of 'postgres'/'postgres' e.g. using docker :
docker run --name postgres -v pgdata:/var/lib/postgresql/data -p 5432:5432 -d postgres --password -e POSTGRES_PASSWORD=postgres
-
Elixir 1.7
Before you start, you might want to quickly read over the Github guides to creating an oauth application, and authorizing oauth applications.
You will need to create a new OAuth application on Github and provide it's CLIENT_ID
and CLIENT_SECRET
values to the release_admin application.
The steps involved are as follows :
## Create github application
Create a new github application via the github.com/settings/applications/new
For testing purposes we've chosen the following values, the only important value is the callback url, which is where OAuth requests will be redirected to:
Having created the application, you will be given the opportunity to copy the GITHUB_CLIENT_ID, and GITHUB_CLIENT_SECRET - Github offers the option to regenerate the secret later if need be.
Export these environmnental variables into the environment in which you will run the 'release_admin' application:
export GITHUB_CLIENT_ID=<GITHUB_CLIENT_ID>
export GITHUB_CLIENT_SECRET=<GITHUB_CLIENT_SECRET>
You will need to generate a random encryption key to prevent credentials being stolen from database backups, etc (data at rest). You can do so using the following code.
iex(2)> 32 |> :crypto.strong_rand_bytes() |> Base.encode64
"VdEdsw4VChhQuVQkLxZ/BVbZ/Eayo7qThpxw2g3DKuA="
Once you have done so, you will need to expose the base64 value as the environmental variable DB_SECRET_KEY
i.e:
export DB_SECRET_KEY="VdEdsw4VChhQuVQkLxZ/BVbZ/Eayo7qThpxw2g3DKuA="
Bootstrap the database, fetch Javascript dependencies, and start the Phoenix web server :
- Install Elixir dependencies with
mix deps.get
- Create and migrate the database with
mix ecto.create && mix ecto.migrate
- Install Node.js dependencies with
cd assets && npm install && cd ../
- Start Phoenix endpoint with
iex --name [email protected] --cookie secret -S mix phx.server
Navigate to the authorization screen and follow the authorization process.
This application will ask for the following (read only) privileges :
- read:user
- user:email,
- read:org
- repo:status