This is a Spring Boot application demonstrating the Twelve-Factor App methodology.
To view the presentation click here.
If you downlaod the repo open presentation.html
.
In either case you can also review slide notes for more information.
- Git
- Heroku CLI
- OpenJDK (Version specified in
system.properties
, typically 17 or higher)
To rebuild presentation.html
after changing presentation.md
, first install marp
then run it.
marp presentation.md
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Run the application locally using Maven:
./mvnw spring-boot:run
The application will be accessible at
http://localhost:8080
.
This application is configured for Heroku deployment using a Procfile
and system.properties
.
-
Log in to Heroku:
heroku login
-
Create a Heroku Application You can create a new app directly or specify a name.
heroku create
If you omit
<your-app-name>
, Heroku will generate one for you. This command also sets up aheroku
git remote. -
Provision a External Services
heroku addons:create heroku-postgresql:essential-0 --wait heroku addons:create heroku-redis:mini --wait
-
Deploy the Application: Push your code to the
heroku
remote (ensure your main branch is up-to-date, e.g.,main
ormaster
depending on your setup).git push heroku main
(If your main branch is named differently, like
master
, usegit push heroku master:main
orgit push heroku master
if your Heroku app's default branch ismaster
). -
Check Build Logs & Status: You can view the build process and logs:
heroku logs --tail
-
Open the Application: Once deployed, open your application in the browser:
heroku open
- Java Version: Specified in
system.properties
. - Process Types: Defined in the
Procfile
(e.g.,web: java -jar target/twelvefactor-notepad-0.0.1-SNAPSHOT.jar
). - Application Properties: Spring Boot configuration is managed in
src/main/resources/application.properties
and profile-specific properties (e.g.,application-dev.properties
,application-prod.properties
). Heroku Config Vars can be used to override these properties for different environments.
Explore these resources to learn more about the Twelve-Factor App methodology, Spring Boot, and Heroku:
- The Twelve-Factor App: 12factor.net
- Spring Boot Guides: spring.io/guides
- Spring Cloud Documentation: spring.io/projects/spring-cloud
- Twelve-Factor Repository: github.com/heroku/12factor
- Simplifying JVM App Development with Heroku’s Buildpack Magic
- Heroku Platform: heroku.com (for deploying applications)
If you have questions or suggestions regarding this sample application, please open an issue or pull request!