Giter Site home page Giter Site logo

argonaut's Introduction

Logo

Reserve testing environments effectively.

About

See caveats below

This application has a very specific use, to let you reserve testing environments for your apps while working with multiple apps and testing environments. It's well-suited for organizations that use the microservice architecture with separate testing, integration and production environments. It lets you add multiple testing environments and applications, and allows logged in users to create a reservation for testing apps in the specified testing environment for a period of time.

Web sockets are used to facilitate real-time updates when users reserve or release an environment

Feature in the work is to add support for multiple teams, where a team can own a set of environments and applications.

Configuration

Each environment has its corresponding settings in config/{environment}.exs file. Your base application configuration lives in config/config.exs. Anything inside this file can be overridden by your environment specific settings.

Development

I use PostgreSQL for data persistence in both development and production environments. The database authentication can be setup in config/dev.exs for running the app locally in development. Argonaut uses the following development defaults:

# config/dev.exs
config :argonaut, Argonaut.Repo,
  adapter: Ecto.Adapters.Postgres,
  database: "argonaut",
  username: "developer",
  password: "banana2017!",
  hostname: "localhost",
  pool_size: 10

To start the app:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Install Node.js dependencies with npm install
  • Start Phoenix endpoint with mix phoenix.server

Now you can visit localhost:4000 from your browser.

Production Deployment

Please check the Phoenix deployment guides for better documentation. However, following is how the app is setup in heroku currently.

Make sure heroku toolbelt is installed on your system. This is easy if you are using homebrew on macOS. If you are using Linux, you know what to do ;)

brew install heroku
heroku login

Instead of hard-coding secret keys and database credentials, config/prod.exs gets the following environment variables from heroku instance.

DATABASE_URL
GUARDIAN_JWK
POOL_SIZE
SECRET_KEY_BASE

Add elixir buildpack for heroku:

heroku create --buildpack "https://github.com/HashNuke/heroku-buildpack-elixir.git"

Add buildpack to compile the static assets:

heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static.git

Enable PostgreSQL:

# this will setup the database and add DATABASE_URL environment
# variable to the application dyno
heroku addons:create heroku-postgresql:hobby-dev

Push code to heroku:

git push heroku master

Setup database pool size and run mix tasks:

heroku config:set POOL_SIZE=18
heroku config:set SECRET_KEY_BASE="`mix phoenix.gen.secret`"
heroku config:set GUARDIAN_JWK="something_secret"
heroku run "POOL_SIZE=2 mix Argonaut.task"
heroku run "POOL_SIZE=2 mix ecto.migrate"
# add environment variables for dyno metadata
heroku labs:enable runtime-dyno-metadata

Caveats

This application is under heavy development so expect to see a lot of bugs. These will mostly manifest in the front-end react.js code. Most notably, the mix of AJAX and websockets needs to be straightened out as well as few obvious refactorings and performance optimizations.

TODO

  • Render reservations
  • Allow users to reserve and release environments
  • Allow team creation
  • Allow team admins to delete owned teams
  • Allow team admins to create new applications
  • Allow team admins to delete owned applications
  • Allow team admins to edit owned applications
  • Allow team admins to create new environments
  • Allow team admins to delete owned environments
  • Allow team admins to edit owned environments
  • Allow user login
  • Allow user signup
  • Allow user password resets

Credits

Logo: Viking Ship by Andrejs Kirma from the Noun Project

Images: Subtle Patterns

Assets used with CC attribution

argonaut's People

Contributors

qubbit avatar

Stargazers

 avatar

Watchers

 avatar  avatar

argonaut's Issues

you can reserve an app in a team you haven't joined (even when you are non-admin)

To reproduce:

  1. as an admin, set up a few teams with valid apps and environments
  2. note down the URL of some of those teams
  3. logout as admin and login as non-admin
  4. as a non-admin user, enter the URL of the team you created in step 2
  5. attempt to reserve a non-reserved environment
    expected: you should not be able to reserve apps on teams you haven't joined
    actual: you are able to reserve apps on teams you have not joined (but know the url to)

Add confirm or undo button for removing reservations

As an admin, I have the ability to remove everyone's reservations. This is nice, but if I accidentally click on a reservation from someone else, there's no way to get it back. In order to prevent accidental deletions when you are logged in as admin (or non admin for that matter), it would be nice to have a confirmation dialog or a way to undo a reservation removal.

Validation failure is hidden from the user

  1. As an admin, login to the app
  2. create a team and then click the admin link for the team you just created
  3. attempt to add an app with just the name
    expect - there would be some error message
    actual - nothing happens except you get this error in the console:
POST https://theargonaut-bay.herokuapp.com/api/teams/8/applications 422 (Unprocessable Entity)
{"errors":{"repo":["can't be blank"],"ping":["can't be blank"]}}

This happens because the fields in both app and environment can't be blank (but aren't marked as such). There is an error raised, but it's invisible to the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.