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
.env
file. Especially the DATABASE_DNS points tolocalhost
. - Both server and client needs an environment variable DOTENV_PATH to know where to find the
.env
file. The Makefile sets it automatically, but be aware if using your own dotenv file. - Execute the server in a terminal using the
make run
command. - In a new terminal you can deploy and undeploy the database using the
make deploy
andmake undeploy
respectively.
- Make sure all environment variables are properly set into the
.env
file. Especially the DATABASE_DNS points topostgres
instead oflocalhost
. - Build the image running into the terminal the command
make build
. - Make sure the
docker-compose
file has the backend specifications uncommented. - Deploy the server and database using the
make deploy
command. Themake undeploy
will 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
.