- Configure Payment provider Stripe
- Copy .template-local.env to .local.env
- Login to https://dashboard.stripe.com/
- Copy the secret key from Developers > API keys

- Add this to .local.env
This configuration will be picked up from IntelliJ's local run configuration (see .run/SbEcomApplication local.run.xml)
STRIPE_SECRET_KEY=
Configure sensitive runtime values (database credentials, API keys, profiles) in the Render service — do not bake secrets into the Docker image or commit them to the repo.
On Render (dashboard):
- Open your service → Settings / Environment → Environment Variables.
- Add variables you need (mark secrets as Private / Secure):
JDBC_DATABASE_URLJDBC_DATABASE_USERNAMEJDBC_DATABASE_PASSWORDSTRIPE_SECRET_KEYSPRING_PROFILES_ACTIVE=prod- Any other keys your app reads (e.g.
JWT_SECRET,MAIL_*, etc.)
- Do not set
PORTmanually — Render providesPORTto the container at runtime and the app should bind to it (the prod profile already usesserver.port=${PORT:8080}).
To deploy to Render from GitHub Actions, some secrets need to be added to the repository. These secrets are used in the GitHub Actions workflow to authenticate and trigger deployments on Render.
RENDER_SERVICE_IDis the ID of the Render service you want to deploy to.RENDER_API_KEYis the API key for the Render account that owns the service.
These keys can be found in the Render dashboard.
https://render.com/docs/deploy-hooks#deploying-from-an-image-registry
-
Create new Service on Render.com
- Go to https://dashboard.render.com/
- Create a new Project -> Use a 'Free Tier'
- Create a new Environment, eg 'Test'
- In this environment create a new Service ('Web Service')
- Choose the provider, eg GitHub and the repostiory (eg sb-ecom)
- Choose a 'Language' and 'Docker' as type
- Choose a 'Free Tier' plan
- Under 'Advanced' set 'Auto-Deploy' to 'Off'
- Click 'Deploy'
- Open the newly Created Service
- Go to 'Settings' / Deploy Hooks and copy the value for the 'Deploy Hook Url'
-
In github (Source: https://render.com/docs/deploy-hooks#deploying-from-an-image-registry)
-
for the repository, go to 'Settings' / 'Secrets and Variables' / Actions
-
Create a new repository secret:
- Name:
RENDER_DEPLOY_HOOK_URL - Paste the value from the Deploy Hook Url
- Name:
Frontend Source: https://github.com/tomzi8571/sb-ecom-frontend Frontend: https://sb-ecom-frontend.onrender.com/
This project includes a Dockerfile that builds the Spring Boot application and produces a runnable image that listens on port 8080 by default.
Local build and run (using .local.env for local values):
# Build the image locally
docker build -t sb-ecom:local .
# Run with environment variables from .env.local and publish port 8080 on the host
# This will make the app available at http://localhost:8080
docker run --rm --env-file .env.local -p 8080:8080 sb-ecom:local
# If you want a different host port (e.g. 5000):
docker run --rm --env-file .env.local -p 5000:8080 sb-ecom:localNotes:
- The Docker image exposes port 8080 (see
EXPOSE 8080in theDockerfile).EXPOSEis metadata;-p hostPort:containerPortondocker runpublishes the container port to the host. - The project uses profile-specific configuration. To run with the
localprofile when running the jar directly:
# Using the packaged jar
java -jar target/sb-ecom-0.0.1-SNAPSHOT.jar --spring.profiles.active=localRender deployment notes
- Render supplies a
PORTenvironment variable to the container and expects the application to bind to that port. The production profile in this repo usesserver.port=${PORT:8080}so it will bind to thePORTRender provides. - If you deploy from a Docker image hosted on GitHub Container Registry (GHCR), ensure Render has access to the registry (add registry credentials in the Render dashboard). Alternatively, configure a Render service to build from the GitHub repo directly.
- The CI workflow in
.github/workflows/docker-deploy-render.ymlbuilds and pushes an image toghcr.io/<owner>/sb-ecomand then triggers a Render deploy via the Render API. Make sure the repository secretsRENDER_API_KEYandRENDER_SERVICE_IDare set and that Render can pull from GHCR (or change the workflow to push to Docker Hub instead).
Optional Dockerfile tweak (safer port handling)
If you'd like the app to always pick up the PORT environment variable at the JVM level even when a properties file is missing, you can modify the Dockerfile entrypoint to pass -Dserver.port=${PORT}. For example:
# inside Dockerfile runtime stage
ENV PORT=8080
ENTRYPOINT ["sh","-c","exec java -Dserver.port=${PORT} -jar /app/app.jar"]This is optional because application-prod.properties already sets server.port=${PORT:8080}, but it can help in edge cases where the properties file is not loaded.
If you want, I can add the optional Dockerfile change now and update the CI workflow to pass the PORT env var explicitly when Render deploys (usually not necessary since Render sets PORT).
Swagger UI: http://localhost:8080/swagger-ui/index.html Api Docs: http://localhost:8080/v3/api-docs
The application exposes Spring Boot Actuator endpoints. The security rules in WebSecurityConfig are configured so that:
/actuator/healthand/actuator/infoare publicly accessible.- All other
/actuator/**endpoints require an authenticated user with theROLE_ADMINauthority.
How to call protected actuator endpoints
- Obtain a JWT by authenticating against the API auth endpoint (the app provides
/api/auth/**for login). Example (replace credentials):
# Request a JWT token (example JSON body; adjust field names to match your auth controller)
curl -X POST https://<YOUR_SERVICE_URL>/api/auth/signin \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"adminPass"}'The signin response will include a JWT token (usually in a field called token or accessToken).
- Call a protected actuator endpoint using the token:
curl -H "Authorization: Bearer <JWT_TOKEN>" https://<YOUR_SERVICE_URL>/actuator/envNotes and production recommendations
- The repository includes a
CommandLineRunnerthat creates a defaultadminuser with passwordadminPassif it does not exist. Change this default password and remove automatic default credentials for production. - Keep
management.endpoint.env.show-values=truedisabled in production unless you absolutely need it. If enabled, ensure actuator endpoints are restricted (only accessible from admin IPs or via VPN) and thatmanagement.endpoint.*.keys-to-sanitizeincludes all your secret keys. - Consider adding network-level restrictions on Render (or cloud provider) and avoid exposing sensitive actuator endpoints publicly.
- If you prefer to secure actuator with basic auth or a specific management user, you can add a dedicated security configuration that applies only to
/actuator/**and uses different credentials.