Skip to content

andremedeiros/loon

Repository files navigation

banner

Made with ❤️ by Andre Medeiros

Show, don't tell

asciicast

What is it?

Loon is a developer tool that aims to facilitate getting started on various projects.

Getting started

$ go get -u github.com/andremedeiros/loon
$ loon rc --bash >> ~/.bashrc # if you're a bash user
$ loon rc --zsh >> ~/.zshrc  # if you're a zsh user

Restart your shell and you're good to go!

A simple payload

# ~/src/github.com/you/awesome-project/loon.yml
name: Your Awesome Project
url: https://github.com/you/awesome-project
deps:
  - postgres
  - redis
  - ruby: 2.7.1
  - node: latest
tasks:
  setup:
    description: Fetches dependencies and runs database migrations
    command: |
      bundle check || bundle install
      rake db:setup
      rake db:migrate
  server:
    description: Starts the web server
    command: bundle exec rails server
  jobs:
    description: Starts the job worker
    command: bundle exec sidekiq
  test:
    description: Runs the test suite
    command: bundle exec rails test

With this example, when you run:

$ loon up

The tool will do a few things, in order:

  • It will generate a Nix derivation that is specific for your project's combination of services and languages.
  • It ensures the derivation can be satisfied, downloads packages if built, or sources if not.
  • It generates a unique IP for your project that is bound to localhost
  • It initializes services (initdb for Postgres, mysqld --initialize-insecure for MySQL)
  • It starts services bound to that IP and their default ports

After that, you can start running commands. In this case, by running loon setup, the tool:

  • Generates an environment for the project, by injecting Twelve-Factor friendly config
  • Executes the specific version of the invoked tool, or the latest supported if not specified

While you're developing, loon test runs your tests, loon server starts the Rails development server, and loon jobs starts a job runner.

Finally, loon down shuts the services down.

Services

Service Versions
Memcached 1.6.{5,6}
MySQL 8.0.{17,21}
Postgresql 9.5.22, 9.6.18, 10.13, 11.8, 12.3
Redis 6.0.{4,5}

Languages

Language Versions
Crystal 0.35.1
Golang 1.13.12, 1.14.4
Node 12.18.{1,2}, 14.{4,5}.0
Ruby 2.6.6, 2.7.1

Acknowledgements