Project

whally

0.13
No commit activity in last 3 years
No release in over 3 years
A ruby gem to dockerize applications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
>= 0
~> 10.0
>= 0
>= 0

Runtime

 Project Readme

Whales

whales logo

Made with Love by Icalia Labs

Whales helps you dockerize your applications by outputting the necessary files to run your application with Docker. Check it out:


  • Installation
  • Usage
    • How does it work?
    • Architecture
    • Command explanation
  • Contributing
  • Copyright

Installation

Whales is distributed and run as a Docker image, so the only thing you need is to have Docker installed and running on your machine. After that just fire up your terminal and run:

docker pull gueils/whales:latest

And that's it! You're ready to use Whales!

Usage

Here's where the magic begins, first of all in your terminal go to the project directory you want to dockerize:

cd code/path_to_project/

And then just execute the following command:

docker run \
  --interactive --tty --rm \
  --env API_BASE_URI=whales.herokuapp.com \
  --env BELUGAS_CODE="${PWD}" \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume $(pwd):/code gueils/whales:latest

By default this command will return dev.Dockerfile & docker-compose.yml files, these are the files you need to run your application in a dev environment with Docker. These files are not perfect, but we're hoping them to be a great starting point for you.

If you need the files for a production environment, run the following command:

docker run \
  --interactive --tty --rm \
  --env API_BASE_URI=whales.herokuapp.com \
  --env BELUGAS_CODE="${PWD}" \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume $(pwd):/code gueils/whales:latest whales tame -e="production"

Until now, this command only returns the Dockerfile for production.

How does it work?

Whales works as a command line interface based on features analyzers, these analyzers can detect multiple features on your project through a code static analysis, in other words, thanks to these analyzers we can detect what language, framework, database and other dependencies your project uses.

Currently, we have four feature analyzers:

The above implies we only support 4 languages: Ruby, PHP, Node(JS) & Python

Architecture

The architecture is simple, it is composed of a flow chain of micro-apps that work together to dockerize your project, we call these "Whales and Belugas Team", this is the outline they follow:

  1. The command you send on the terminal conveys a signal to Whales, so he can start the process of dockerizing your application.
  2. Whales ask his bud Belugas the features of your project. Belugas is the head member of the Belugas Team: The Feature Detector Team 🐳
  3. Belugas starts by calling his smarty-pants bud, linguistic to find out the primary language your project is using.
  4. Depending on this language, liguistic will ask one of his other buddies: belugas-ruby, belugas-php or belugas-python to search specific information in your repo.
  5. When they're done, these fellows will send back the information founded (features) to the main Belugas.
  6. Belugas will send the features to Whales.
  7. Whales will receive the features and used them along with his intelligence to build the need it Docker files
  8. Finally, Whales will display the files on the terminal.

Command explanation

Above command is a bit hard to digest at first glance, so here's a breakdown of what the options of the command are meant for:

  • --interactive --tty --rm: This tells Docker to run in an interactive mode and to clean up the container when it exits.
  • --env API_BASE_URI=whales.herokuapp.com & env BELUGAS_CODE="${PWD}": This sets two environment variables, the first one tell Whales where to find our secret sauce, and the other one points out the code to analyze.
  • volume /var/run/docker.sock:/var/run/docker.sock: This allows us to run Docker commands inside of a container (since all Belugas are also docker images).
  • volume $(pwd):/code gueils/whales: This finally mounts a volume with the code of your application.

What's with the cetacean name?

Well, they're really cool animals! 🐳 🐋 🐬

Contributing

Everyone is freely to collaborate, just make sure you follow our code of conduct. Thank you contributors!

Create an Issue

Find a bug and don't know how to fix it? Have trouble following the documentation or have a question about the project? Then. by all means please create an issue.

Just please make sure you check existing issues to see if what you're running into has been addressed already.

Submit a Pull Request

That's great! Just follow this steps:

  1. Create a separate branch for your edits
  2. Make sure your changes don't break the project by running your changes against current specs. We love tests! so it'll be even better if you create new ones when needed
  3. Open your pull request against master

Once you've created a pull request, maintainers will chime in to review your proposed changes and to merged it if everything is right 🎉

I want to contribute but don't know where to start

That's great also! We already have some open issues for you to dive in.

Copyright

See LICENSE

Icalia Labs

Whales is maintained with love by Icalia Labs