• Stars
    star
    340
  • Rank 121,869 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Collection of Ansible playbooks to quickly start your Django Application

#パタヒン (Metamon)

      /~\_.-~-._,--.._
     |                ~-.._
      |     .     .        \
      |                    /
      |     --._..'       | \
      /                      \
     |                        |
     |                        \
     /                         |
     \_.-._  __...___.._______/
           ~~

Metamon is a Vagrantfile combined with a set of Ansible Playbooks which can be used to quickly start a new Django project.

##Motivation Setting up a development environment when starting a new project always turns out to be a tiresome and time consuming task. Metamon is a collection of Ansible Playbooks that aims to correct this by providing a standarized, automated and generic* environment (both for development and production). This way projects can be started a lot faster by just being able to jump directly into development.

Although Metamon is easily extensible by adding new Ansible roles, it is a better fit for people who use Django + Gunicorn + Nginx + PostgreSQL.

* generic in the context of Django applications.

##Features Metamon will:

  • Create an Ubuntu 14.04 machine.
  • Set-up basic Operating system dependencies.
  • Set-up a Virtualenv and automatically install dependencies.
  • Set-up Supervisor, PostgreSQL 9.3, Gunicorn and Nginx.
  • Start a new Django project if it's needed.
  • Automatically activate a virtualenv and cd to the project's directory when logging in during development.
  • Use separate requirements files for faster deploys.
  • Separate settings file for unit testing with coverage and customized settings to make testing faster.

... and more.

##Installation

  1. Download and install Virtualbox.
  2. Download and install Vagrant.
  3. Install Ansible with pip: pip install ansible.
  4. Copy the Metamon files to your project's root directory (or to a new one if you have not started yet) and customize.
  5. Create a new virtual machine by running vagrant up from your project's root directory.
  6. Deploy a new virtual machine by running the deploy_dev.sh script in the deploy directory. If you already have your code in there, no project should be created.

##Configuration and Customization

Configuration

In the deploy/group_vars directory are two values on all.yml that need to be set before the Playbooks can be run. project_name needs to be given the project's name. It will be used for finding the directory containing the Django project (or to create it) and used for pointing to some of the modules (for example urls). secret_key needs to also be set and is used in Django's settings file in SECRET_KEY.

If pull_repo is defined then repo_url must be defined. By default, the master branch will be used.

Vagrant

By default, Vagrant will provide a machine called dev that can be reached at 192.168.50.10. Several ports are forwarded:

  • 80 to 8080 (for Nginx).
  • 8000 to 8000.
  • 9000 to 9000 (for Gunicorn).

The directory where the Vagrantfile is placed is shared with the virtual machine via the /vagrant/ directory. All of this can be changed by editing Vagrantfile.

For more information on what's installed please take a look at the ROLES.md file.

Requirements

The requirements for the Django application will also be installed automatically, however, they are split into three different files. There are also settings that define which requirements are installed during deployment.

  • requirements.txt should hold the packages needed to run the Django application. It is automatically installed with the application role.
  • test_requirements.txt should hold packages needed for running unit tests but not required by the application. It is automatically installed with the testing role.
  • dev_requirements.txt should hold packages needed only when developing (ipdb for example). Installation is marked by install_development_requirements and it is automatically set to Yes when the development role is selected.

Settings and settings for testing

Settings are automatically generated by the /deploy/roles/application/templates/django/settings*.py.j2 files. Two settings files are generated, one for the regular Django settings and one for running the unit tests. You probably want to run tests like so:

python manage.py test --settings=project_name.settings_test

.gitignore

Keep in mind that the .gitignore included in this repository is rather bare. It is recommended that you add rules for ignoring IDE files and generated binary files (for example SQLite databases). It is also a good idea to ignore the <project name>/static/ (collectstatic) directory.

Contributing

So far, Metamon has been an internal tool, and has been maintained in the little free time available to us. Bugs may appear, and there is a lot of room for improvement.

If you happen to come across a bug, please create an issue providing as much information as possible. If you want to help, fork the project and submit your Pull Requests. All contributions are most welcome.

More Repositories

1

luminoth

Deep Learning toolkit for Computer Vision.
Python
2,398
star
2

norfair

Lightweight Python library for adding real-time multi-object tracking to any detector.
Python
2,335
star
3

requestium

Integration layer between Requests and Selenium for automation of web actions.
Python
1,821
star
4

fetch-it

An enhanced HTTP client based on fetch.
JavaScript
237
star
5

TLSphinx

Swift wrapper around Pocketsphinx
C++
156
star
6

aws-workshop

Learn to deploy real applications in a scalable way, using Amazon Web Services.
Python
152
star
7

react-examples

Examples of using React
JavaScript
131
star
8

awesome-tryo

A curated list of awesome resources we use at Tryolabs
116
star
9

TLMetaResolver

TLMetaResolver is an extension to UIWebView written in Swift that adds the ability to parse the meta tags in the loaded web page
Swift
80
star
10

django-kitsune

Host server monitoring app for Django Admin. Allows to schedule checks on hosts and notify results to administrators by mail.
Python
66
star
11

taggerine

Annotation tool for images
JavaScript
64
star
12

TLAnimatedSegue

Segue for present controllers with custom animations.
Objective-C
58
star
13

daywatch

E-commerce scraping and analytics platform.
Python
53
star
14

graphql-parser

GraphQL parser for Python
Python
48
star
15

django-tastypie-extendedmodelresource

An extension for TastyPie's ModelResource, to allow features such as easily having multiple nested resources.
Python
44
star
16

stable-diffusion-dreambooth

A notebook containing code to train your own Dreambooth model using Stable Diffusion.
Jupyter Notebook
43
star
17

nginx-docker

Based on official nginx Docker image and h5bp, with templating and custom intialization script support
Shell
38
star
18

soccer-video-analytics

Demo on how to compute soccer ball possession automatically using AI.
Python
37
star
19

vierjavibot

JavaScript
30
star
20

libreQDA

JavaScript
29
star
21

TLFormView

A universal iOS form
Objective-C
25
star
22

object-detection-workshop

Learn the inners of object detection with Deep Learning by understanding Faster R-CNN model, and how to use Luminoth to solve real-world problems.
Jupyter Notebook
25
star
23

lambda-mailer

Uses AWS lambda to create a serverless endpoint for processing a contact form.
Python
24
star
24

social-media-scraper

Scrapes social media handles out of websites.
JavaScript
17
star
25

nvd3-tags

Declarative NVD3 charts
JavaScript
13
star
26

python-simple-getty

Python
8
star
27

norfair-ros

ROS package for multi-object tracking using Norfair.
Python
8
star
28

causal_inference

Measure the impact of an intervention in a time series, using different sources as references.
Python
6
star
29

jimbot

CoffeeScript
5
star
30

fashion-assistant

Jupyter Notebook
5
star
31

khipu-2023

4
star
32

norfair-ros-dev

Full ROS environment combining different nodes for object detection and tracking using Norfair.
Python
3
star
33

dvc-template

A template repository for projects using DVC
Python
3
star
34

squat-wars

Squat counter game featured at Khipu 2023 running on a Raspberry Pi 4 together with a Coral TPU
Python
2
star
35

TryoCoQA

A Conversational Question Answering dataset for Tryolabs' blog posts.
2
star
36

cookiecutter-django-docker

Python
2
star
37

temporian-examples

2
star
38

python-workshop

Code for the Python workshop on building the snake game using pygame.
Python
1
star