PGSync
Generated on 15 Nov 2025 from the PGSync catalog page
PGSync is a Python service that streams changes from PostgreSQL into Elasticsearch/OpenSearch using Postgres WAL. It’s designed for low-latency indexing, large tables, and resilient checkpointing via Redis/Valkey.
**This 1-Click Droplet **boots a hardened Ubuntu image with PGSync preinstalled and a first-boot wizard that asks for:
- SCHEMA_URL – URL to your schema.json mapping (e.g., raw GitHub URL).
- PG_URL – Postgres connection string.
- ELASTICSEARCH_URL – OpenSearch/Elasticsearch endpoint.
- REDIS_URL – Valkey/Redis endpoint (used for checkpoints).
PGSync runs as a systemd service under a non-root user (pgsync), with logs in journalctl. Firewall (UFW) allows only SSH by default. Optional: offer a Managed Database at launch; if a customer selects it, credentials are auto-injected and available at /root/.digitalocean_dbaas_credentials, and a DATABASE_URL env is set for convenience.
Software Included
| Package | Version | License |
|---|---|---|
| pgsync | 6.0.0 | MIT |
| python | 3.11.0 |
Creating an App using the Control Panel
Click the Deploy to DigitalOcean button to create a Droplet based on this 1-Click App. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.
Creating an App using the API
In addition to creating a Droplet from the PGSync 1-Click App using the control panel, you can also use the DigitalOcean API. As an example, to create a 4GB PGSync Droplet in the SFO2 region, you can use the following curl command. You need to either save your API access token to an environment variable or substitute it in the command below.
curl -X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer '$TOKEN'' -d \
'{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image":"pgsync"}' \
"https://api.digitalocean.com/v2/droplets"Getting Started After Deploying PGSync
After the Droplet boots, SSH in and run:
sudo pgsync-setup
Enter:
- SCHEMA_URL (e.g., https://raw.githubusercontent.com////schema.json)
- PG_URL (Postgres connection string)
- ELASTICSEARCH_URL (OpenSearch/Elasticsearch endpoint)
- REDIS_URL (Valkey/Redis endpoint)
PGSync runs as a systemd service (“pgsync”). Check logs:
journalctl -u pgsync -f
Update settings: edit /etc/pgsync/pgsync.env then:
sudo systemctl restart pgsync
Firewall: UFW allows SSH only.