Skip to content

African-Cities-Lab/_african-cities-lab-org

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

African Cities Lab

Build Status Black code style GitHub license

African Cities Lab website africancitieslab.org

Requirements

  • docker
  • docker-compose
  • ansible

Development instructions

To set up a development environment, install the requirements and initialize pre-commit as follows:

pip install -r requirements/local.txt
pre-commit install

Deployment instructions

This site is based on the cookiecutter-django template, so further valuable information can also be found in its documentation.

Local deployment

  1. Build the stack:

    docker-compose -f local.yml build
    docker-compose -f local.yml up

    alternatively, the above commands can be replaced by using the deploy.local.yml ansible playbook as in:

    ansible-playbook ansible/deploy.local.yml
  2. Run the migrations:

    docker-compose -f local.yml run django python manage.py migrate
  3. Create a super user:

    docker-compose -f local.yml run django python manage.py createsuperuser

Staging/production deployment

Server setup

In order to set up the staging and production servers, the following commands should be run once:

  1. Create two computing server instances (e.g., AWS EC2, DigitalOcean droplet...), one for staging and another for production, and ensure that you have root ssh access rights to both (e.g., by running ssh root@<server-ip>).

  2. Register a domain and create A DNS records to redirect the to the server IP addresses, e.g., create an A record mapping the base domain (e.g., "example.com") to the production server and another A record mapping a staging subdomain (e.g., "staging.example.com") to the staging server.

  3. Execute the ansible/setup.staging.yml and ansible/setup.production.yml playbooks to setup the production and staging servers respectively:

    # ansible-playbook ansible/setup.staging.yml  # for staging
    ansible-playbook ansible/setup.production.yml  # for production
  4. Create two storage bucket instances (e.g., AWS S3, DigitalOcean spaces...), one for staging and another for production.

  5. Ensure that .envs/.staging/.django and .envs/.production/.django have the correct access keys for the staging and production storage buckets respectively.

Deployment

Once the servers are setup, you can push the latest commit to the main branch of this repository (https://github.com/African-Cities-Lab/african-cities-lab-org) and then deploy them to staging/production by executing the ansible/deploy.staging.yml and ansible/deploy.production.yml playbooks respectively:

# ansible-playbook ansible/deploy.staging.yml  # for staging
ansible-playbook ansible/deploy.production.yml  # for production

The web application should be now up and running in the staging and production servers

Acknowledgments

Built with Cookiecutter Django

  • The ansible playbook of this repository is based on the approach of rrebase/knboard.

About

No description, website, or topics provided.

Resources

License

Unknown, GPL-3.0 licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •