# Self-host OpenSearch

> A single node OpenSearch search and analytics engine with the security plugin on, a persistent volume, a generated admin password and a 512 MB Java heap. The API speaks HTTPS with a self signed certificate and is not published on the host, so reach it from other services in this project at opensearch:9200.

- Page: https://levelrail.com/templates/opensearch/
- JSON: https://levelrail.com/templates/opensearch.json
- Category: Database Tools
- Licence: Apache-2.0 (Permissive license)
- Source: https://github.com/opensearch-project/OpenSearch
- Upstream docs: https://opensearch.org/docs/latest/

## Requirements
- Memory: about 1.5 GiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: 3.3.0

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| opensearch | opensearchproject/opensearch | 3.3.0 | 9200 | opensearch_data -> /usr/share/opensearch/data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| opensearch | OPENSEARCH_INITIAL_ADMIN_PASSWORD | generated |
| opensearch | OPENSEARCH_JAVA_OPTS | preset |
| opensearch | bootstrap.memory_lock | preset |
| opensearch | discovery.type | preset |

## Deploy

### CLI

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

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/opensearch/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. Read the generated admin password from the app secrets, then call the API over HTTPS as the admin user from a service in the same project.

## Questions

### Can I deploy OpenSearch 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 OpenSearch, 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 opensearchproject/opensearch:3.3.0 is what you deploy there.

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