A rails and react app that provides a daily coding prompt in Ruby. Deployed using Docker on a raspberry pi.
4
Roodle provides a daily coding prompt to help users sharpen their skills in Ruby. The UI is loosely modeled after Wordle, with five test cases showing red, green or yellow to indicate a failing, passing or exception-raising test case, respectively.
erDiagram
Prompt ||--|| TestSuite : "has one"
TestSuite ||--o{ TestCase : "contains many"
- Daily coding prompt
- In-browser code editor (via CodeMirror)
- Responsive design - works on mobile as well
- Progess tracking over time - coming soon!
- Frontend: React.js, JavaScript, HTML, CSS, Material UI v5 with Emotion
- Backend: Ruby on Rails API
- Database: PostgreSQL
- Containerization: Docker
- Deployment: Raspberry Pi
Install front end dependencies
npm install
This project includes an .nvmrc file so if using nvm, you can do
nvm use
to grab the correct node version
Install backend dependencies
bundle install
Spin up the app
bin/dev
Roodle is currently deployed on my personal raspberry pi using docker and hosted through a Cloudflare tunnel. These are the steps I use to update the live application.
Steps to make changes:
- Get on the branch you want to push up
- Create a new docker build with a new version number and the correct build name. See current version at top of this document. Don't forget to specify the architecture as arm which is compatible with raspberry pi. Use buildx
docker buildx build \
--platform linux/arm64 \
--provenance=false \
-t shacon/roodle:arm-{BUILD_NAME}-v{VERSION} \
-f Dockerfile.dev \
--push \
.
- Push the image to docker hub -
docker push shacon/roodle:{BUILD_NAME}-v{VERSION} - Ssh into raspberry pi
- Navigate to root of app which holds docker-compose.yml
- Pull the image
docker-compose pull shacon/roodle:{BUILD_NAME}-v{VERSION} - Modify image name on pi's docker-compose.yml
- Restart the application with the new image
docker-compose down docker-compose up -d
Right now, I have a rake task that imports new prompt data. On my pi, I run:
docker-compose exec app bin/rake ingest_prompt_data
List tunnels
cloudflared tunnel list
Check config file
Restart tunnel
sudo systemctl restart cloudflared
Verify tunnel config
cloudflared tunnel route dns roodle-tunnel roodlegame.com
Test tunnel
cloudflared tunnel test
- [DONE] Parse code before sending it to Piston so it runs properly
- [] Refactor so that only one api call needs to be made
- [DONE] In UI, show user that call has been made and is waiting for response, disable button
- [] Write tests
- [DONE] Add upload process for data - rake task that ingests prompt data
- [DONE] No need to store anything from the user - that should all be in localStorage - get rid of submissions table?
- [] Create UI to display historical prompt attempts
- [] Allow user to navigate to previous day's prompt and attempt results
- [DONE ]Add solve() with the input arg? - stick to one name, one arg for now - add more later?
- [] Allow user to save their results in easily shareable copy