Git Product home page Git Product logo

openstates.org's Introduction

openstates.org

This repository contains the code responsible for openstates.org, the website and v2 API (graphql).

Make changes

Changes should be made in a local checkout of the repo. There is a bit of setup to get a working DB and environment, which by default will run in docker.

  • Branch off of the develop branch
  • Follow instructions for working on openstates.org from the docs.
  • Quirks I ran into:
    • npm run start did not actually make JS/CSS available when I hit the app at localhost:8000. Instead I ran npm run build and then rebuilt the docker containers with docker compose build, finally started them again.
    • For some reason my DB ended up missing a row representing the Django Site. This resulted in something like "Site not found" error when trying to log in/register. Solution was:
      • Get shell on the running container sudo docker exec -it openstatesorg-django-1 /bin/bash
      • In that shell run poetry run python manage.py shell --settings=web.settings
      • In THAT shell run from django.contrib.sites.models import Site;Site.objects.get_or_create(domain='openstates.org', name='openstates.org')
      • However for me this created an entry with SITE_ID of 2 when 1 is the necessary value to match up with web/settings.py
  • Merge your feature branch into develop (this launches a workflow that publishes docker images)
  • Merge develop into main (this gets code into the branch that should be used for deploy)

Deploy

  • Check out the main branch of this repository to your local workstation
  • You will need permissions on the Open States AWS account to be able to interact with at least the parameter store and the EC2 instance where the site is deployed
  • You need the SSH private key to access the EC2 instance, stored at ~/.ssh/openstates-master.pem
  • Ensure that you have the correct python version installed via pyenv
  • Install the aws cli tool
  • Install ansible, such that ansible-playbook command is available. (There are recent changes in the package re: ansible-community which might necessitate a change in our deploy script. For now, I just deployed a somewhat older version via my operating system's package manager)
  • Install the jq utility
    • Whichever python your system is using to execute ansible-playbook needs botocore and boto3 packages installed. These are used on the system running ansible-playbook to do AWS secret/parameter lookups. Since I installed ansible via my operating system's package manager, I installed via sudo apt install python3-boto3 python3-botocore
  • In your copy of this repo, with main checked out, run the command, which runs a script which runs a set of ansible tasks:
poetry run inv deploy

All the steps should be OK. It's normal to see a lot of output of things changing. You should get to something like the following near the end:

PLAY RECAP ************************************
openstates.org             : ok=41   changed=6

Links

openstates.org's People

Contributors

bcks avatar colbyreed avatar csnardi avatar dependabot[bot] avatar estaub avatar heyitsolivia avatar hiteshgarg14 avatar in-vincible avatar jamesturk avatar jessemortenson avatar jgarber623 avatar jjshanks avatar jmcarp avatar johnseekins avatar mileswwatkins avatar newageairbender avatar nloui avatar schneidy avatar sharms avatar tophers42 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.