BirdTouch-WebAPI is a server that is consumed by Birdtouch Android app.
Server is written in .NET 5.0 using PostgreSQL database.
- Docker
- Docker compose
- Port
4050
to be free and not used by any app on the machine where docker daemon is running
- Configure
.env
file (see Configuration section) - Run
docker-compose up -d
from the root of this repo - Run
docker-compose ps
to check if all services are up and running- Note:
database-migration
service should be in StateExit 0
- Note:
- Congratulations! WebAPI (with database) is now available on port
4050
All SQL scripts used to create database and to insert necessary data are located in the migrations folder.
In order to add custom new scripts or execute database upgrade, please follow the following procedure:
-
Create new .sql script following the naming convention in the migrations folder - idea is that scripts are alphabetically sorted in order to have some sort of the order of execution.
-
Note that scripts that are once executed will not be executed again on the same database (to check if script is executed, script name is used)
-
When you have all the necessary scripts now added to the migrations folder, please execute:
docker-compose up database-migration --build
All of the configuration is done by editing .env file.
-
Recommended changes:
- Update
POSTGRES_PASSWORD
and connection strings used to access the database. - Update
PGADMIN_DEFAULT_PASSWORD
password used for accessing PgAdmin app. - Change
JWTSecurityKey
that is used for hashing of the authorization tokens.
- Update
-
Optional:
RemoveInactiveUsersRunEvery
scheduled task that will check if there are inactive usersRemoveInactiveUsersRemoveUsersOlderThan
set how many hours of inactivity are considered for user to be in inactive state
If you are using WSL2 on Windows10 and have Linux container where you installed docker, in order to access Birdtouch WebAPI (e.g. from the Birdtouch Client running on Android emulator) you need to found out the WSL2 session's IP address.
Do the following procedure:
- Login to Linux machine with WSL2
- Execute
ifconfig
- Find the
net
value of theeth0:
, for example it would be172.22.200.173
- Congratulations, now you can access your Birdtouch WebAPI running on WSL2 Linux container via
172.22.200.173:4050
- Check if port where WebAPI is working (usually 4050) is accessible to the world:
- If not, configure it to be! :)
- [OPTIONAL] noip.com site provides DUC tools that synchronize your dynamic Ip Address to some hostname, that way, you can host anything from your local PC and not worry about Ip Address change