Heidi, it's time to cook! 🧑🍳
You'll need Docker Compose, Ruby, and Rails to run Flavortown. We strongly encourage using a Unix-based system (Linux or macOS). If you're on Windows, check out GitHub Codespaces!
-
Clone this repo!
git clone https://github.com/hackclub/flavortown
(this will already be done for you if you use GitHub Codespaces!)
-
Set up a PostgreSQL database.
docker compose up -d db
-
Enter Rails via Docker Compose. Run all other commands within this container!
docker compose run --service-ports web /bin/bash
-
Install all dependencies.
bundle install
-
Set up your
.envfile by copying overexample.env. You'll need to follow the instructions in said.envfile!cp example.env .env
-
Create an app on Hack Club Auth (HCA) Staging. Go to https://hca.dinosaurbbq.org/developer/apps, and click the
app me up!button.- redirect URI:
http://localhost:3000/oauth/callback - select ALL THE SCOPES!!!!
You may get an error like
The requested scope is invalid, unknown, or malformedwhen authenticating. If this is the case:- copy the
&state=<...>parameter of the failing URL. - go to your app on HCA, and
Right click > Copy LinkonTest Authto the right of the redirect URI. - you should get a URL like this:
https://hca.dinosaurbbq.org/oauth/authorize?client_id=c1b86a9f2073eec8e457ce3eb169afb9&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Foauth%2Fcallback&response_type=code&scope=openid+profile+email+name+slack_id+verification_status - append the
&state=<...>parameter you copied in the first step to the URL - navigate to that URL, and go through the normal auth flow
This is only an issue in development environments.
- redirect URI:
-
Generate Rails credentials.
EDITOR="nano" bin/rails credentials:edit --environment=development⚠️ You might not be able to runcredentials:editfrom outside the Docker container because of build errors. If this is the case, click here.
credentials:editmight fail on your machine outside of the Docker container. For example, on a fresh GitHub Codespaces box, I couldn't install thefaissgem, as it failed the build step.The problem with this is that we have no visual editors in the Docker container. As such, you'll have to install one.
# For Debian/Ubuntu: apt-get update && apt-get install -y nano # For Alpine: apk update && apk add nano # For CentOS: yum install nano
After installing
nano, you should be able to invokecredentials:edit.
You'll see an editor with a
.ymlfile open. Take a look atdocs/example_dev_creds.ymlfor examples of how this file should look like! You've already generated some of these for.env- make sure they're the same.If you're using
nano, press CTRL + S to save, then CTRL + X to exit. -
It's time to cook! Run
bin/dev!
If you already did all of the steps above previously, but e.g. your PC or Codespace restarted, you only need to do a subset of the steps above.
-
Set up a PostgreSQL database.
docker compose up -d db
-
Enter Rails via Docker Compose. Run all other commands within this container!
docker compose run --service-ports web /bin/bash
-
Some dependencies might've changed from the last time you've worked on Flavortown. Doesn't hurt to check!
bundle install
-
It's time to cook! Run
bin/dev!