Skip to content

jasonaowen/recurse-community-portfolio

Repository files navigation

Recurse Center Community Portfolio

Discover all the things Recursers have built!

The Recurse Center Community Portfolio is a website dedicated to showcasing work done by attendees of the Recurse Center. The collection is inclusive, meaning that projects which are small or messy or incomplete are welcome, and it is author-driven, meaning that it respects authors' privacy and is uncurated.

Read more about the project goals and features.

Thank you to each of the contributors who have made this project better!

Getting Started

This project is written in Java 11, and you will need OpenJDK 11 installed.

IDE

I recommend the community edition of IntelliJ IDEA. Project definitions are included in the repo.

Building

This project uses gradle to manage dependencies and build scripts. It includes a copy of the gradle wrapper, which you can invoke directly:

$ ./gradlew build

The build task will both run the tests and build the project.

You can just run the tests with the test task:

$ ./gradlew test

Running

There are several environment variables the app needs. For convenience, these are consolidated in the file .env.template. Copy it to .env (which is ignored by git) with cp .env.template .env, and then edit it to add the following information.

To run the web app locally, you will need to configure a both an OAuth application and a personal access token in your Recurse Center app settings. Create an app with the redirect URI to http://127.0.0.1:8080/login/oauth2/code/recurse, then take the client ID and client secret and set the environment variables CLIENT_ID and CLIENT_SECRET. Create a personal access token and set the environment variable ACCESS_TOKEN.

The app requires a PostgreSQL database. Configure your PostgreSQL server to allow TCP/IP connections, create a user with a password, and then create a database. Put the database URL and credentials in the JDBC_DATABASE variables in your .env file.

Run the database migrations to create the database structure:

$ source .env
$ ./gradlew flywayMigrate

Populate the database by running the API sync:

$ source .env
$ ./gradlew bootRun --args="apiSync"

Then, execute the bootRun task to start the web server:

$ source .env
$ ./gradlew bootRun

The server should now be accessible at http://127.0.0.1:8080/.

Deploying

Heroku

This app can be deployed to Heroku.

First, create an application:

$ heroku apps:create

Create an OAuth application and a personal access token in your Recurse Center app settings. Set the OAuth callback URL to be https://your-application-name.herokuapp.com/login/oauth2/code/recurse. Configure your Heroku app with the credentials:

$ heroku config:set \
    ACCESS_TOKEN=your_access_token
    CLIENT_ID=your_client_id \
    CLIENT_SECRET=your_client_secret

Install the Heroku PostgreSQL add-on:

$ heroku addons:create heroku-postgresql:hobby-dev

(Heroku automatically configures the JDBC_DATABASE_URL, JDBC_DATABASE_USERNAME, and JDBC_DATABASE_PASSWORD environment variables when it detects a Java application.)

Creating the application on the command line should automatically configure a new git remote. Push the code to Heroku:

$ git push heroku master

Then, populate the database:

$ heroku run 'java $JAVA_OPTS -jar build/libs/*.jar apiSync'

Your Heroku instance should be ready to use!

Licensed under the AGPL, version 3