What you’ll do
- Start the application and its dependencies with Docker Compose.
- Mint a short link via the
/shortenendpoint. - Use the provided hammer script to send 200 requests to that short link.
- Inspect the application logs (and Postgres) to confirm every request was recorded.
Prerequisites
- Docker and Docker Compose installed
- curl (or any HTTP client)
- Access to the lab environment where the repository and
hammer.shscript exist
Quick lab steps
- Start services:
- Mint a short link:
- Hammer the short link:
- Inspect logs to confirm every request hit Postgres.
Detailed example session
Start the services:2Bi). Use that returned code when running the hammer script. For example, if the service returned 2Bi, run:
If your environment uses a different short code (for example some exercises may reference
cat42), substitute that code when invoking ./hammer.sh. The important part is to target the actual short code returned by the /shorten endpoint.Inspecting logs and Postgres
- Watch the application logs printed to the terminal from
docker compose up— you should see log lines for each redirect request. - Alternatively, connect to the Postgres container and query the table that stores hits (table name may vary by lab). Example:
Endpoints reference
Troubleshooting tips
- If you get an unexpected short code, always use the returned code when running
./hammer.sh. - Ensure the
app,redis, andpgservices are healthy indocker compose psbefore sending traffic. - If logs show errors connecting to Postgres, confirm network/service names in
docker-compose.ymland that the DB has initialized.
Links and references
- Docker Compose: https://docs.docker.com/compose/
- curl manual: https://curl.se/docs/manpage.html
- PostgreSQL documentation: https://www.postgresql.org/docs/