-
Notifications
You must be signed in to change notification settings - Fork 0
Running a Server
Run the main() in src/main/kotlin/ContentServer.kt to view your ReadingBat content.
Running with redis enabled is optional. It is unnecessary for creating content, but highly advisable in production.
The server can be run in two modes: development and production.
Development mode allows you to see updates to the Content.kt description file and challenge code without restarting the server.
Enable development mode with:
-
Assign readingbat.site.production in application.conf to false.
-
Uncomment ktor.deployment.watch in application.conf.
Run the server in development mode with:
-
Run the server with:
make run
in a terminal window. Alternatively, you can run the main() in ContentServer.kt from your IDE. -
Compile the code continuously with:
make cc
in a different terminal window. This step is optional. Without it, you will have to restart the server after changes to the Content.kt description file. -
View your content at http://0.0.0.0:8080 (or http://127.0.0.1:8080 if you are using Windows)
Production mode will cache challenges and parse them only once.
Enable production mode with:
-
Adjust the
readingBatContent.repo
property in Content.kt to reference the appropriateGitHubRepo
value. -
Assign readingbat.site.production in application.conf to true.
-
Comment out ktor.deployment.watch in application.conf.
Create an uberjar with: make uberjar
Run the server in production with: java -jar build/libs/server.jar
There are numerous deployment hosting options including: docker, Heroku, gitpod.io