Giter Site home page Giter Site logo

athena-oss / athena Goto Github PK

View Code? Open in Web Editor NEW
90.0 16.0 26.0 2.85 MB

An automation platform with a plugin architecture that allows you to easily create and share services.

Home Page: https://athena-oss.github.io/athena/

License: Apache License 2.0

Shell 100.00%
athena plugin-architecture docker bash automation

athena's Introduction

image

Build Status Join the chat at https://gitter.im/athena-oss/Lobby

Automate, Automate, Automate!

The key to optimize work is to automate as much as possible. Whether you are developing software, setting up infrastructure or even testing, if there is a chance to do it just take it.

Most of the times the boring and frequent tasks can be automated. There are a lot of different tools and technologies that can help you with that, but sometimes starting is simply an hassle by itself and one might end up giving up and doing it "manually".

This is where Athena jumps in. The idea is quite simple, we minimize the start process by :

  • automating the wiring of the dependencies and tools
  • implement a plugin architecture to allow freedom and scalability
  • throw in a wizard that takes care of the boring stuff

Once that part is done, you can reuse it as much as you can and you can even share with other people or teams.

Seems cool, right?

Well, it might also seem too easy or too abstract so let's dig into it.

How does it work?

Athena aims to be of simple usage and architecture and consists of 2 pillars:

  • the Engine: a declarative framework based in bash ( say that again ??? Don't run away yet because it has proper unit tests. To know more about it, have a look at the bashUnit Testing Framework for bash. It has all of the common features an xUnit Framework gives, including Mocking.)

  • the Plugins: they are typically Services, Applications, Jobs, etc. They can use any technology or any stack of technologies and they form the ecosystem that helps you handle different scenarios. To support the automation environments, the virtualisation technology used is docker.

As an example, you can use Athena to setup a webserver, test your website and handle the deployment. This example could be achieved by creating 3 plugins: webserver, test and deploy or you could simply create just one : app.

Hopefully the ecosystem will continue to grow and become big enough so that most of the scenarios will be already handled and you can use an existing plugin, build your own from scratch or even base yours on another one.

Why did we choose bash?

We wanted to make it simple and having the minimum dependencies possible. Using bash became a natural choice because that's where you usually start when you automate with scripts.

bash already has support for a lot of stuff, but the issue is that is not very declarative or at least does not have a very developer-like syntax, and this is why Athena was born. A simple, declarative and developer-friendly framework with testing support.

Why should you use it?

Besides having a very straightforward and simple architecture, which makes it easy to debug, it provides you built-in support for solving the following topics :

  • Version validation
  • Error handling
  • Proper display of messages
  • Stacktrace
  • Testing
  • Routing
  • Support for Multiple and configurable environments
  • Hooks
  • Standardized way of building stuff
  • etc...

With this already taken care of you will only need to focus on your specific problem.

Table of contents

Quick start

Prerequisites

  • You have a bash shell.
  • You have Git installed.
  • You have Docker installed.

There are three quick start options available:

On Linux

  • Using a debian package from the releases :
$ sudo dpkg -i <downloaded_debian_package>
  • Using apt-get :
$ sudo add-apt-repository ppa:athena-oss/athena
$ sudo apt-get update
$ sudo apt-get install athena

On MAC OSX

$ brew tap athena-oss/tap
$ brew install athena

Note: You might be required to allow Docker to access folders managed by Homebrew. In order to do this, go to Docker Preferences > File Sharing and add the folder /usr/local/Cellar.

Alternative

Go to the Documentation Website or download the Documentation PDF to find out more about using Athena.

Examples

We have several examples here. Check these two Athena commands, so that you can have an idea how it looks like :

running a file/directory validator

CMD_DESCRIPTION="Validates a file or directory for possible issues."

athena.usage 1 "<file|directory>"

if athena.plugins.base.check "$(athena.path 1)" ; then
  athena.ok "check passed"
  athena.exit 0
fi
athena.fatal "check failed"

running a php webserver

CMD_DESCRIPTION="Starts the webserver."

athena.usage 2 "<source_directory> <port>"

# arguments are found below
source_directory="$(athena.path 1)"
port="$(athena.int 2)"

# clearing arguments from the stack
athena.pop_args 2

# options for container are found below
athena.plugin.use_external_container_as_daemon "php:7.0-apache"

# mounts the specified dir into the container
athena.docker.mount_dir "$source_directory" "/var/www/html"

# maps the specified host port to the port 80 of the container
athena.docker.add_option "-p $port:80"

Plugins

Here is a list of some of the available plugins :

  • PHP Plugin - Plugin for Test Automation using PHP as a development language.
  • Selenium Plugin - Plugin to handle browser automation using Selenium.
  • Proxy Plugin - Plugin to handle a proxy server using Browsermob-proxy.
  • Appium Plugin - Plugin to handle mobile automation using Appium.
  • AVD Plugin - Plugin to manage Android Virtual Devices.
  • Gradle Plugin - Plugin for running gradle tasks.

Contributing

Checkout our guidelines on how to contribute in CONTRIBUTING.md.

Versioning

Releases are managed using github's release feature. We use Semantic Versioning for all the releases. Every change made to the code base will be referred to in the release notes (except for cleanups and refactorings).

License

Licensed under the Apache License Version 2.0 (APLv2).

athena's People

Contributors

bassco avatar geraldvillorente avatar gserra-olx avatar pproenca avatar rafaelspinto avatar romanfinkelnburg avatar saschacurtholx avatar savar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

athena's Issues

Unnecessary Docker output when running "athena new-issue"

Athena Environment

OS: Darwin deupc00064 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
Athena version: 0.10.2
Plugins:
 - atlas [1.3.0]
 - base [0.10.2]
 - php [0.7.2]
 - proxy [0.3.1]
 - selenium [0.3.1]
Images:
 - olx/athena-proxy-olx [0.3.1] 578266a8af89
 - olx/athena-proxy [0.3.1] 4c166e57adfd
 - olx/athena-migrations [1.0.0] 2b27823f4e07
 - olx/athena-gui [1.0.1] 6e3f6f1390ca
 - olx/athena-php7.0-php-php7.0 [1.0.0] 07fdd085b117
 - olx/athena-atlas [1.1.0] 892f90c0fd76
 - olx/athena-atlas [1.2.3] 892f90c0fd76
 - olx/athena-atlas [1.3.0] 892f90c0fd76
 - olx/athena-php5.6-php-php5.6 [1.0.0] 85946af3eb37
Running containers:
 - athena-selenium-0-firefox::selenium/node-firefox:2.53.1-beryllium
 - athena-selenium-0-hub:4444:selenium/hub:2.53.1-beryllium
 - athena-plugin-proxy-0:9090-9999:olx/athena-proxy-olx:0.3.1

I'm running Docker for Mac Version 1.13.0 (15072). Before the actual new-issue output I see:

Usage:	docker COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default "/Users/caio.moritz/.docker")
  -D, --debug              Enable debug mode
      --help               Print usage
  -H, --host list          Daemon socket(s) to connect to (default [])
  -l, --log-level string   Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/Users/caio.moritz/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/Users/caio.moritz/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/Users/caio.moritz/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:
  checkpoint  Manage checkpoints
  container   Manage containers
  image       Manage images
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  volume      Manage volumes

Commands:
  attach      Attach to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  deploy      Deploy a new stack or update an existing stack
  diff        Inspect changes on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.

get_host_ip_for_linux() broken on newer ifconfig output format

Reproducible on Athena 0.10.3 running on Archlinux.

Function athena.os._get_host_ip_for_linux depends on a certain ifconfig output pattern that has changed in newer versions.

It used to be like this:

inet addr:{$ip_address} netmask ... broadcast ...

Now it's like this:

inet {$ip_address}  netmask ... broadcast ...

Both versions need to be supported.

Athena help command not printing long global flags

When running athena or even athena -h, the output is incomplete: no help on the --athena- long global flags are printed. This is what's missing:

You can also use the following athena flags :
    --athena-dbg                                     Enables the debug mode.
    --athena-env=<name|file_with_environment_config> Specifies the environment to be used.
    --athena-dns=<nameserver_ip>                     Specifies which nameserver will be used in the container.
    --athena-no-logo                                 Suppresses the logo.

Athena Environment

OS: Darwin deupc00064 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
Athena version: 0.10.4
Plugins:
 - atlas [1.4.2]
 - base [0.10.4]
 - gradle [1.0.0]
 - php [0.7.4]
 - proxy [0.3.1]
 - selenium [0.3.1]
Images:
 - olx/athena-proxy-olx [0.3.1] 578266a8af89
 - olx/athena-proxy [0.3.1] 4c166e57adfd
 - olx/athena-migrations [1.0.0] 2b27823f4e07
 - olx/athena-gui [1.0.1] 6e3f6f1390ca
 - olx/athena-php7.0-php-php7.0 [1.0.0] 07fdd085b117
 - olx/athena-atlas [1.1.0] 892f90c0fd76
 - olx/athena-atlas [1.2.3] 892f90c0fd76
 - olx/athena-atlas [1.3.0] 892f90c0fd76
 - olx/athena-atlas [1.4.0] 892f90c0fd76
 - olx/athena-atlas [1.4.2] 892f90c0fd76
 - olx/athena-php5.6-php-php5.6 [1.0.0] 85946af3eb37
Running containers:

A clear guideline on how to setup Athena to run with Behat or Selenium.

@rafaelspinto I witness the presentation of MC (from OLX Philippines) about Athena and I am really amazed of how this tool can do from a QA standpoint to DevOps.

So I started to play after MC's presentation and the most obvious thing from the documentation is the setup. I am on Ubuntu and there is no clear guide on how to access the tool after running apt-get install athena. I tried athena wizard star but I am completely blind on that one.

Eager contributor here once I know how the system works.

Output more details when "plugins update" command fails

Athena version: fb66cf6

When running this command inside my own fork:

./athena plugins update php --athena-no-logo

I got the following error output (not very informative):

[ERROR] there was a problem updating the plugin 'php'

It would be handy to have the git command stderr contents appended to our error message.

Simplified release process

There's currently too many steps required for releasing Athena and its plugins. Currently the process involves the following:

  • Create a local git tag and push it to the remote
  • Update the CHANGELOG.md file with a diff manually generated
  • Update plugins/base/version.txt (Athena project) or version.txt (any plugin project)
  • Update the respective brew tap definition
  • Update the respective Debian package in Launchpad

This process is slow, error prone and can definitely be simplified.

athena.plugin.set_plg_cmd_dir should expect ':' separated paths instead of ' ' space separated

athena.plugin.set_plg_cmd_dir expects right now one or more directories separated by empty spaces which is not a typicall way in an Unix environment and will break on directories containing empty spaces.

So instead of relying on empty spaces athena should expect a ':' separated list in ATHENA_PLG_CMD_DIR and the athena.plugin.set_plg_cmd_dir and athena.plugin.get_plg_cmd_dir method documentation needs to reflect that.

Docker Compose Support

It would be great if athena would provide first–class docker-compose support to allow for a better startup of more complex environment (e.g. in an integration test, when mySQL and ElasticSearch is necessary), docker compose is really helpful for that.

Additionally, it would be great to specify a list of await commands that are executed until the exit with code 0 (e.g. a curl request that checks if elastic search has booted yet).

Add command for generating the GitHub issue context

The upcoming GitHub issue template will contain instructions on how to generate your issue template. My idea is to ask users to run athena new-issue to generate the initial Markdown description. The template will include indispensable info like:

  • Athena version
  • Athena plugins (name and version)
  • OS version
  • Running containers
  • Images

Unrecognized plugins

I am trying to setup Athena on a Win7 Machine. I already installed docker and git. i ran my bash commands on the VM to install the plugins, but after installing the plugins, i am having a unrecognized command when i ran "athena selenium". Can you help me with this?

athena fails if directory name has space

I am using Google Drive for storing my data in cloud and my directory structure is something like "/Users/abhishektomar/Google Drive/infra/athena" but whenever I am running athena command to do any thing it failed because of space in a directory name.

error what I am getting is:
docker: Error parsing reference: "Drive/infra/athena/terraform:/opt/platform_terraform" is not a valid repository/tag.

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.