Manages the collection and visualization of wagbag stations for SNCC members. Backend consists of a dockerized rails framework hosted through a swarm configuration.
-
Docker Desktop
Engine >= 19.03.5
Compose >= 1.24.1
-
Twilio account w/ one virtual phone number
-
Clone the repository:
~$: git clone [email protected]:Syntaf/wagbag.git
-
Create a new docker volume for persistant database storage
~$ cd wagbag ~$ docker volume create postgres_database
-
Use docker-compose to spin up postgres and rails containers
~$: docker-compose up
-
Run pending migrations and seed the database
~$: docker-compose exec web entrypoint.sh rake db:migrate ~$: docker-compose exec web entrypoint.sh rake db:seed
-
Visit the app at https://localhost:3001/dashboard
Some additional configuration is needed in order to receive inbound SMS. If you don't need to work with inbound SMS these steps can be skipped, just keep in mind you'll only be able to work with the seeded data. Before following the steps, ensure you have a Twilio account with an active virtual phone number
-
Create three files inside
./dev-secrets
:twilio_account_sid.txt
containing your twilio account SIDtwilio_auth_token.txt
containing your twilio auth tokentwilio_phone_number.txt
containing your twilio phone number.
Example contents of twilio_account_sid.txt:
AD2e13455506d111172dag6d465fdffd36
-
Spin up the app with
docker-compose up
-
Visit
https://localhost:4040/status
. Under the command_line section you should see a URL field, copy this to your clipboard. This URL will be used by twilio to route inbound SMS messages to your local active dev environment -
Go to https://www.twilio.com/console and navigate to your phone number
To utilize binaries like rake
and rails
, use the following commands
# Connect a terminal to the web container
~$: docker-compose exec web entrypoint.sh bash
# Connect a rails console to the web container
~$: docker-compose exec web entrypoint.sh rails c
Running rake db:seed
inside the container will seed the database with development data.
Running rake db:migrate
inside of the container will run all pending migrations
Due to rails running inside a composer instance, rake db:reset
is not available. Instead, inside the container, run:
rake db:drop
rake db:create
rake db:migrate
rake db:seed