The service that is going to defeat the laziness.
Try it out on https://milestone.yaskovdev.com.
Pick one of the below options.
Based on the official PostgreSQL guide.
- Install Docker.
- Run the database container:
docker run --name db -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=motive -d --restart unless-stopped postgres
- Verify container is running:
docker ps -a
brew install postgresql
brew services start postgresql
createuser -s postgres
createdb motive --encoding='utf-8' --template='template0;'
In the project root run ./mvnw spring-boot:run -D"spring-boot.run.profiles=local"
.
This works in PowerShell. If that does not work in your command line, try removing the double quotes. If still does not
work, try removing the quotes and adding a space after -D
.
Or, if you are using IntelliJ IDEA, make sure that "Active profiles" is set to local
and run from the IDE.
Add the next parameters to your Spring Boot configuration:
spring.datasource.url
spring.datasource.username
spring.datasource.password
as on the following screenshot:
It is useful if you want to, say, debug a mobile client against the back end that is running on a local computer.
- Configure port forwarding for ports
3000
and8080
. They should be forwarded to your local computer where the back end and the Web app will be running. You can find the IP address of the computer using theipconfig
command. It usually starts with192.168
. - Create a DNS
A
record for your domain (assuming your domain isyaskovdev.com
). The record should map bothmilestone-local.yaskovdev.com
andapi.milestone-local.yaskovdev.com
to the same IP address: a public IP address of your local network. You can find it here. - Wait for some time for the DNS record to become visible everywhere.
- Make sure that both your local computer and your phone are connected to your local network (local router).
- In
application-local.yml
replace the value ofauthentication.success.url.web
withhttp://milestone-local.yaskovdev.com:3000
. - In
application-local.yml
replace the value oflogout.success.url
withhttp://milestone-local.yaskovdev.com:3000/login
. - In
application-local.yml
replace the value ofcookie.domain
withmilestone-local.yaskovdev.com
. - In the
motive-web-app
, in the.env.development
file, replace the value ofREACT_APP_API_URL
withhttp://api.milestone-local.yaskovdev.com:8080
. - Run both the back end and the Web app.
- Make sure the back end is running and accessible by opening http://api.milestone-local.yaskovdev.com:8080/actuator/health.
- Make sure the Web app is running and accessible by opening http://api.milestone-local.yaskovdev.com:3000.
- In your phone open http://milestone-local.yaskovdev.com:3000.
Create the next system environment variables:
AZURE_OPENAI_API_KEY
AZURE_OPENAI_ENDPOINT
AZURE_OPENAI_DEPLOYMENT_MODEL_ID
Based on this guide.
Make sure that subscriptionId
in pom.xml
is your active Azure subscription.
Make sure that in Azure Portal "Settings" -> "Environment variables" -> "App settings" has the next entries properly configured:
SPRING_DATASOURCE_PASSWORD
SPRING_DATASOURCE_USERNAME
JWT_TOKEN_SIGNING_KEY
GITHUB_CLIENT_SECRET
VK_CLIENT_SECRET
And "Connection strings" has the next entry properly configured: milestone
.
Then run the next commands:
mvn clean package
mvn azure-webapp:deploy
Use this guide.
Use this guide.
docker image build -t yaskovdev/motive-back-end .
docker image push yaskovdev/motive-back-end
For Local, go to http://localhost:8080/actuator/health.
For Prod, go to https://api.milestone.yaskovdev.com/actuator/health.
For Local, use this link.
For Prod, use this link.
- If you cannot connect from your local computer to the PostgreSQL database deployed to Azure, make sure that your IP address is added to the "Firewall rule name" in the "Networking" page in the "Azure Database for PostgreSQL flexible server".
- If you press "Try Without Login" in the UI and get redirected back to the login page, make sure that
the
Authorization
cookie is set (most likely it isn't, therefore you get redirected back to the login).