Wiredcraft / devops-ansible

Ansible folder structure, including playbooks / plugins / etc.
0 stars 1 forks source link

Django support #56

Closed JuhaS closed 8 years ago

JuhaS commented 9 years ago

I prepared this a bit further, this is what I have. The task doesn't yet work properly but I now have understanding on how it should work.

Node:

# Find out more about nodes: http://docs.devo.ps/manual/nodes

id: djangonode
name: djangonode
type: server

# Find out more about providers and their defaults
# in their respective documentations
provider:
  name: digitalocean
  size: 66
  location: 6
  image: 6918990

# vars:

services:
  mysql: "*"
  uwsgi: "*"

configuration:
  mysql:
    users:
      - name: dj
    databases:
      - name: djdb
        users: 
          - dj

Task:

# Find out more about tasks: http://docs.devo.ps/manual/tasks

id: deploy
name: Deploy Django app
type: task

# triggers:

targets:
 - djangonode

vars:
  workdir: /opt/djangoapp
  git_repo: https://github.com/JuhaS/django-sample-app

steps:
 - run: devops git update
   options: 
     dest: "{{ workdir }}"
     repo: "{{ git_repo }}"
 - run: devops uwsgi app_add
   options:
     name: djangoapp
     port: 8000
     root: "{{ workdir }}"
     module: wsgihandler:application
     requirements_file: "{{ workdir }}/requirements.txt"
     virtualenv: djvenv

What needs changing / fixing:

DATABASES = {
    'default': {
        # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'dev_database_name'
    }
}

@zbal Probably best if we crunch this working together, it's pretty close already.

zbal commented 9 years ago

Public repo has been created - https://github.com/devops-community/django Can effectively install everything and get the app runinng.

@JuhaS - test with another (more complete) django app for validation.