-
Notifications
You must be signed in to change notification settings - Fork 1
How‐to: Local DEV deployment using docker
Welcome to the whereis-api-v0 project! This quick-start guide is your fast track to setting up a local development (DEV) environment using Docker containers. Designed for Mac and Linux folks who already have Docker installed, this guide is all about a fresh, frictionless deployment. Less setup, more coding. It just works!
- By default, we keep things super simple with SQLite as the local database.
- We'll start the Whereis API container on port 8037.
- To make life easier, the database comes preloaded with two built‑in sample tracking numbers:
eg1-012301230123eg1-123412341234
When the dust settles, you'll have one happy, healthy container:
IMAGE STATUS PORTS NAMES
local/whereis-api-v0 Up ... (healthy) 0.0.0.0:8037->8037/tcp whereis-api-v0
git clone https://github.com/eagle1-sys/whereis-api-v0
cd whereis-api-v0make whereisCurious about what else you can do?
make helpLet's make sure the application is healthy and talking to the database. You should expect a friendly 200 OK status.
curl -I http://localhost:8037/app-healthTest the status API using one of our built-in sample tracking IDs:
curl http://localhost:8037/v0/status/eg1-012301230123Test the Whereis API with an authorization header. Use our handy test key eagle1 to make sure authenticated requests are working smoothly:
curl http://localhost:8037/v0/whereis/eg1-012301230123 --header 'Authorization: Bearer eagle1'Want to see how fast it goes? Benchmark the API performance using ApacheBench:
ab -n1000 -c200 localhost:8037/v0/status/eg1-012301230123Example output on an Apple Macbook Air M5 (2 Core, 2GB for docker):
Requests per second: 4466.52 [#/sec] (mean)
Time per request: 44.778 [ms] (mean)
Time per request: 0.224 [ms] (mean, across all concurrent requests)
Transfer rate: 1613.88 [Kbytes/sec] received
Here's a quick cheat sheet for what files do what:
docker-compose.yaml (needs modification)
- APP_PORT
- APP_ENV
- WHEREIS_API_KEY
source-api-keys.env (needs modification)
- Logistics source API keys
Dockerfile (rarely modified)
- APP_PORT
config.ts (do not modify)
- Application default configuration
There are two types of API keys you'll need to know about:
-
SOURCE_API_KEY: These are the keys required to fetch data from logistics sources (like FedEx). You'll need to grab these directly from the providers. Pop open the
source-api-keys.envfile to set yourFDXandSFEXAPI keys. -
WHEREIS_API_KEY: These keys guard your own Whereis API service. You can create any unique keys you like! By default,
eagle1acts as a demo key for checking those two preloaded sample tracking numbers.Want to create a new
WHEREIS_API_KEYto retrieve real tracking numbers? Replace the placeholdersk-WHEREISKEYbelow:# Let the system generate a random key for you make api-key # Or, set a specific key yourself make api-key ARGS="--user=new --key=sk-WHEREISKEY"
Then, update your docker-compose.yaml:
WHEREIS_API_KEY: sk-WHEREISKEY
Whenever you tweak these settings, give the API a quick redeploy:
make updateRun the built-in unit tests to ensure everything is humming along perfectly:
make testcurl http://localhost:8037/v0/whereis/fdx-123412341234 \
--header 'Authorization: Bearer sk-MYSECRETEKEY'And that's a wrap! Enjoy your shiny new API.
If SQLite isn't enough for you, you can easily swap over to Postgres.
make whereis DB_TYPE=postgresMake sure to change the default database passwords (_CHANGEME_) to keep things secure!
-
Change those passwords!
Update the whereis_user password (replace
YOUR_DB_PASSWORDwith a real password):docker exec -it whereis-postgres psql -U postgres -c "ALTER USER whereis_user WITH PASSWORD 'YOUR_DB_PASSWORD';"
Update the postgres superuser password (replace
YOUR_POSTGRES_PASSWORDwith a real password):docker exec -it whereis-postgres psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'YOUR_POSTGRES_PASSWORD';"
-
Update your config files
Modify
docker-compose.yamlso thePOSTGRES_PASSWORDandDB_PASSWORDvalues match what you just set. -
Redeploy both containers
make update DB_TYPE=postgres
(C) 2025 Eagle1