A micro service for real time data persistence
There are two ways to run this service, via localhost or using docker-compose. Even so all required commands are located into the Makefile
- Make sure all environment variables are properly set into the
.envfile. Especially the DATABASE_DNS points tolocalhost. - Both server and client needs an environment variable DOTENV_PATH to know where to find the
.envfile. The Makefile sets it automatically, but be aware if using your own dotenv file. - Execute the server in a terminal using the
make runcommand. - In a new terminal you can deploy and undeploy the database using the
make deployandmake undeployrespectively.
- Make sure all environment variables are properly set into the
.envfile. Especially the DATABASE_DNS points topostgresinstead oflocalhost. - Build the image running into the terminal the command
make build. - Make sure the
docker-composefile has the backend specifications uncommented. - Deploy the server and database using the
make deploycommand. Themake undeploywill undeploy both containers as well.
Once server and database are both running, it's all ready for sending requests to the server. The command make ping will send a dummy request for you. However, this will fail if the database do not have the expected table: locations.
To make it so, into the sql folder are provided both sql scrips to create the database and drop it. Also, the docker-compose deploys an instance of pgadmin in order to manage de database and execute such scrips.
When connecting to the database through pgadmin remember that all credentials are located into the .env file and the database's host is postgres.