- Fork this repository into your own personal space on GitHub.
- You might want to setup branch protection if you are working in a team so direct commits to main are restricted and then branches and pull requests/reviews are required for all team members:
- In your repository navigation to Settings > Branches
- Under “Protected Branches” select 'main'
- Enable the following settings:
- Protect this branch
- Require pull request reviews before merging
- Dismiss stale pull request approvals when new commits are pushed
- Include administrators
You can work with this project locally or in Github Codespaces. With Codespaces you get 120 hours free per month, so keep within your quota.
- Java 11 should be installed on your machine, verify
java --version
- Build the project
mvnw.cmd clean install (Windows)
./mvnw clean install (Mac/Codespaces/Linux)
For local testing before pushing the code use the following
mvnw.cmd spring-boot:run -pl java-api (Windows)
./mvnw spring-boot:run -pl java-api (Mac/Codespaces/Linux)
Frontend URL - http://localhost:8080/index.html
Further Reference
Note: From Codespaces, you can allow public access to the running application, see here for details. This will allow others outside of your codespace to navigate to the url - this can be useful for team testing or demos. Alternatively you can push the code to a server as in the next section.
-
Click on codespace
-
It will open new window with Visual studio in it
-
In Editor in terminal first run
mvnw clean install
-
Once that is finished run below command
./mvnw spring-boot:run -pl java-api
-
Once finished on right bottom corner it asks for "Open in Browser" and "Make Public". Click on "Make Public"
-
Go to Ports, you will find an URL where application can be accessed
-
This is completely Optional for coding challenge, make sure you will not enter any payment method to fly.io
-
Register for an account on fly.io
-
Go to www.fly.io
-
Click on signup
-
Enter any personal account email id and password
-
Click on top left corner, it will take you to dashboard. Confirm you are using Trial Plan and there is no payment method added
-
-
Install flyctl
-
Authorise flyctl to access your fly account
flyctl auth login
- Generate a new app, enter a unique name or generate one
flyctl apps create
- Enter the app name into fly.toml
- Manually trigger the Java Deploy to fly.io workflow (or edit the action to trigger on push to main branch)
- App should be available on {appname}.fly.dev
Note: you might need to scale the app resources
fly scale memory 2048 -a {appname} (To scale memory)
or
fly scale vm shared-cpu-2x {appname} (To scale CPU)
See fly documentation for more guidance