Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
chore(README): add docker command for specifying custom port
Browse files Browse the repository at this point in the history
Also properly handle SIGTERM/SIGINT events and stop the service gracefully. This is useful for those running the docker container and want to stop the service via normal commands.
  • Loading branch information
dtfiedler committed Nov 16, 2023
1 parent 4707894 commit 2fa675f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ Build and run the container:

```shell
docker build --build-arg NODE_VERSION=$(cat .nvmrc |cut -c2-8) --build-arg NODE_VERSION_SHORT=$(cat .nvmrc |cut -c2-3) . -t arns-service
docker run -p 3000:3000 arns-service
docker run -e PORT=3000 -p 3000:3000 arns-service
```

You can run on a different port by changing the `-e PORT=3000 -p 3000:3000` to `-e PORT=4000 -p 4000:4000`, for example.

## Warp

The service leverages `warp-sdk` to retrieve, evaluate and cache contract state. To request a contract state, run:
Expand Down
10 changes: 10 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ process.on('uncaughtException', (err) => {
errorCounter.inc();
});

process.on('SIGTERM', () => {
logger.info('SIGTERM received, exiting...');
process.exit(0);
});

process.on('SIGINT', () => {
logger.info('SIGINT received, exiting...');
process.exit(0);
});

const serverConfigs = {
port: +(process.env.PORT || 3000),
keepAliveTimeout: 120_000, // two minute timeout for connections
Expand Down

0 comments on commit 2fa675f

Please sign in to comment.