Hey! First of all, thank you for interviewing with GovPredict.If you’ve made it this far, it means we’re already impressed with your background, abilities, and potential to fit in with our team.
Your objective is run this rails application in PRODUCTION mode!
You must create containers to each of these services:
- Application
- PostgreSQL
- ElasticSearch
- Redis
- RabbitMQ
The orchestration of these containers must performed by Kubernetes.
We will evaluate the performance and quality of all Dockerfiles and Kubernete file. The rails application is already configurated using enviroment variables to each service, just use it to connect your services.
We set up the enviroments variables in the rails code, you just have to set up in your way to run the application. You don't need to change the rails application.
Available configurations
PG_DATABASE=...
PG_HOST=...
PG_USER=...
PG_PASSWORD=...
Available configurations
ELASTICSEARCH_URL=...
The RabbitMQ consumer performs using Sneakers gem. You will have to start the sneakers to create an instance to start listening to the messages posted in RabbitMQ.
Available configurations
RABBITMQ_URL=...
RABBITMQ_EXCHANGE=...
RABBITMQ_QUEUE=...
Start sneakers using this command:
WORKERS=Workers::LegislatorWorker bundle exec rake sneakers:run
Sidekiq is a tool to manage the async job. The application will run a job after receiving a RabbitMQ's message. Sidekiq uses the Redis to persist his queue, you must configure the Redis and connect to the application.
Available configurations
REDIS_URL=...
bundle exec sidekiq
You must run this command when run the first time the application, this command set up the Postgres database.
./bin/setup
You should configure your application to run in PRODUCTION mode. tips: you can use ngix + puma/unicorn
Post a message in the RabbitMQ queue with this structure to present the data
{
"name": "Legislator",
"chamber": "house"
}
Check the result in the root's page of you application
http://localhost:3000
- The application should run in Production Mode. A tip to run the rails in this way is to set up Nginx and Puma.
- We like our software to have well-thought architecture. Think about more than just getting your solution working -- think about how you can best organize your code.
- You can change the rails application if you think you need. Document these changes in the README.
- Bonus: Deploy the application to 3 different containers, and load balance requests to this instances using nginx.