# Self-host NSQ

> A realtime distributed message queue with a lookup daemon, a queue daemon and the nsqadmin web page, run together. Producers and consumers in this project connect to nsqd:4150 and nsqd:4151.

- Page: https://levelrail.com/templates/nsq/
- JSON: https://levelrail.com/templates/nsq.json
- Category: Infrastructure
- Licence: MIT (Permissive license)
- Source: https://github.com/nsqio/nsq
- Upstream docs: https://nsq.io/overview/design.html

## Requirements
- Memory: about 256 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: v1.3.0

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| nsqadmin | nsqio/nsq | v1.3.0 | 4171 | none |
| nsqd | nsqio/nsq | v1.3.0 | 4150, 4151 | nsqd_data -> /data |
| nsqlookupd | nsqio/nsq | v1.3.0 | 4161 | none |

## Deploy

### CLI

```bash
levelrail-cli templates deploy nsq --name my-nsq
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/nsq/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## First run
1. Open nsqadmin to watch topics and channels, then publish to nsqd:4151 from a service in this project.

## Questions

### Can I deploy NSQ on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for NSQ, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image nsqio/nsq:v1.3.0, nsqio/nsq:v1.3.0, nsqio/nsq:v1.3.0 is what you deploy there.

Self-host NSQ, NSQ docker compose file, deploy NSQ on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
