Giter Club home page Giter Club logo

vocab-server's Introduction

vocab-server

Installation

Install Prerequisites

admin:~$ sudo apt-get install git fabric postgresql python-setuptools postgresql-server-dev-all python-dev rabbitmq-server
admin:~$ sudo easy_install pip
admin:~$ sudo pip install virtualenv

Setup Postgres

admin:~$ sudo -u postgres createuser -P -s <db_owner_name>
Enter password for new role: <db_owner_password>
Enter it again: <db_owner_password>
admin:~$ sudo -u postgres psql template1
template1=# CREATE DATABASE vocab OWNER <db_owner_name>;
template1=# \q (exits shell)

Clone the repository

Set the database configuration

### File: VOCAB_SITE/vocab_site/settings.py

# configure the database
DATABASES = {
	'default': {
	    'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'vocab',
        'USER': '<db_owner_name>',
        'PASSWORD': '<db_owner_password>',
        'HOST': 'localhost',
        'PORT': '',
    }
}

Setup the environment

admin:$ fab -f fabcommands.py setup_env
admin:$ source ../env/bin/activate
(env)admin:$

Setup the project

(env)admin:$ fab -f fabcommands.py setup_project
...
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use '<system_user_name>'): 
E-mail address:
Password:
Password (again): 
Superuser created successfully.
...

Setup RabbitMQ

admin:~$ sudo rabbitmqctl add_user <username_for_rabbitmq> <password_for_rabbitmq>
admin:~$ sudo rabbitmqctl add_vhost <vhost_name>
admin:~$ sudo rabbitmqctl set_permissions -p <vhost_name> <username_for_rabbitmq> ".*" ".*" ".*"

Setup Celery

Configure vocab/celery.py

app = Celery('vocab',
		broker='amqp://<username_for_rabbitmq>:<password_for_rabbitmq>@localhost:5672/<vhost_name>',
		include=['vocab.tasks'])

Configure VOCAB_SITE/celeryd.conf

command=/path/to/vocab_container/env/bin/celery worker -A vocab --loglevel=DEBUG
directory=/path/to/vocab_container/vocab-server/VOCAB_SITE
stdout_logfile=/path/to/vocab_container/logs/celery/outworker.log
stderr_logfile=/path/to/vocab_container/logs/celery/errworker.log

Configure VOCAB_SITE/supervisord.conf

logfile=/path/to/vocab_container/logs/supervisord/supervisord.log
childlogdir=/path/to/vocab_container/logs/supervisord/

Create upstart script in /etc/init named vocab-email.conf

description    "supervisor for vocab-email"
start on runlevel    [2345]
stop on runlevel    [!2345]

respawn

setuid <your system username>
chdir /path/to/vocab_container/vocab-server/VOCAB_SITE
exec /path/to/vocab_container/env/bin/supervisord --nodaemon

Control celery tasks with: sudo {start|stop|restart} vocab-email. Every change done to any file involving celery (including tasks.py), requires a restart of the celery service.

Starting

While in the VOCAB_SITE directory, run

(env)admin:$ python manage.py runserver

vocab-server's People

Contributors

cr8onski avatar ljwolford avatar

Watchers

James Cloos avatar Paulie Jesukiewicz avatar

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.