[{"data":1,"prerenderedAt":129},["ShallowReactive",2],{"seo-verification":3,"blog-postgresql-on-a-vps-a-reliable-and-controlled-database-en":6},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"id":7,"slug":8,"slugs":9,"title":12,"excerpt":13,"readTime":14,"views":15,"isPinned":16,"publishedAt":17,"category":18,"categories":24,"featuredImage":26,"bgImage":27,"posterImage":28,"relatedSolution":29,"intro":32,"sections":33,"ctaTitle":82,"ctaBody":83,"ctaButton":84,"ctaUrl":85,"relatedPosts":86},56,"postgresql-on-a-vps-a-reliable-and-controlled-database",{"fr":10,"en":8,"ar":11},"heberger-postgresql-vps","postgresql-على-خادم-vps-قاعدة-بيانات-موثوقة-ومتحكم-بها","PostgreSQL on a VPS: a reliable and controlled database","Host PostgreSQL on a VPS: volumes, backups, restricted network access and sound configuration for your applications.",4,0,false,"2026-04-25T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},6,"Databases","bases-de-donnees","bg-teal-500\u002F10 text-teal-400","database",[25],{"id":19,"name":20,"slug":21,"color":22,"icon":23},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fheberger-postgresql-vps-poster.svg",{"categorySlug":30,"appSlug":31},"databases","postgresql-stack","PostgreSQL is often the trusted database of business applications, APIs and analytics tools. On a ServOrbit VPS, you control the version, the storage, the backups and the access instead of paying for a managed database by the GB. The guide focuses on the decisions that matter: persistence, users, network and restoration.",[34,38,48,51,76,79],{"type":35,"title":36,"body":37},"h2","Why self-host PostgreSQL on a VPS","Managed databases (RDS, Cloud SQL) bill per GB stored, per IOPS and per connection, and often limit the available extensions. By deploying PostgreSQL on your own VPS, you enable `pg_stat_statements`, `PostGIS`, `pgvector` or `TimescaleDB` without restriction, you choose your exact version (15, 16, 17) and you keep your data in a jurisdiction you control. A VPS with an NVMe SSD disk and a dedicated CPU offers very low I\u002FO latencies, ideal for the transactional workloads of a production application. You pay a fixed and predictable flat rate, and you alone decide on your strategy for replication, encryption and backup retention.",{"type":39,"title":40,"items":41},"ul","The concrete benefits of a self-hosted PostgreSQL",[42,43,44,45,46,47],"Fixed and predictable cost: no billing per GB, per IOPS or per number of active connections.","Free extensions: `pgvector` for AI, `PostGIS` for geospatial, `TimescaleDB` for time series.","Full control of backups: scheduled `pg_dump`, `pg_basebackup` or physical replication to a second VPS.","Fine tuning of `postgresql.conf` (shared_buffers, work_mem, WAL) impossible with most managed offerings.","Data sovereignty: your data stays on an infrastructure you choose.","Real superuser access to audit, profile and optimize without a support ticket.",{"type":35,"title":49,"body":50},"Hardware and software prerequisites","For a development PostgreSQL instance or a small production project, plan for a VPS with 2 vCPU, 4 GB of RAM and 40 GB of NVMe SSD: PostgreSQL likes memory for its page cache. For a heavier load (several hundred connections or datasets of several tens of GB), aim for 4 vCPU and 8 GB of RAM. On the software side: Ubuntu 22.04 or 24.04 LTS, Docker Engine and the Docker Compose v2 plugin, a domain name pointing to the VPS (e.g. `db.mydomain.com`) if you expose remote access, and a `ufw` firewall configured to let through only the strict minimum. Also reserve a dedicated Docker volume for `PGDATA` to decouple the data from the container.",{"type":52,"title":53,"steps":54},"steps","Deploy PostgreSQL with Docker in production",[55,58,61,64,67,70,73],{"title":56,"body":57},"Prepare the VPS and the firewall","Connect via SSH, update the system with `apt update && apt upgrade -y`, install Docker via `curl -fsSL https:\u002F\u002Fget.docker.com | sh`. Block port 5432 from the outside with `ufw deny 5432`: the database must never be directly exposed to the Internet.",{"title":59,"body":60},"Write the docker-compose.yml","Create a `postgres:17` service, mount a named volume on `\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata`, and define `POSTGRES_PASSWORD`, `POSTGRES_DB` and `POSTGRES_USER` via a `.env` file that is never committed. Add `shm_size: 256mb` for large sorts and a `healthcheck` with `pg_isready`.",{"title":62,"body":63},"Launch and initialize the database","Start with `docker compose up -d`, check the logs via `docker compose logs -f postgres`, then connect with `docker compose exec postgres psql -U app -d mabase`. Create your application roles with minimal privileges rather than using the superuser.",{"title":65,"body":66},"Expose access via a tunnel or a TLS proxy","For secure remote access, never open 5432 in the clear: use an SSH tunnel (`ssh -L 5432:localhost:5432`) or place `pgbouncer` behind a reverse proxy. Enable SSL on the PostgreSQL side with a Let's Encrypt certificate mounted in the container (`ssl = on` in `postgresql.conf`).",{"title":68,"body":69},"Tune the configuration","Adjust `shared_buffers` to about 25% of the RAM, `effective_cache_size` to 50-75%, and `work_mem` according to your queries. Enable `pg_stat_statements` to identify slow queries. Use the PGTune tool as a starting point.",{"title":71,"body":72},"Automate the backups","Schedule a daily `pg_dump` via a cron task on the host, compress into custom `.dump` format, and copy the archives to external storage. Regularly test restoration with `pg_restore`: an untested backup does not exist.",{"title":74,"body":75},"Logging in for the first time","pgAdmin is not published on the internet: open a tunnel from your own machine (ssh -L 5050:127.0.0.1:5050 root@\u003CIP>), then go to http:\u002F\u002F127.0.0.1:5050 and sign in with admin@local.host and the password provided. Then add your server (\"Add New Server\") with host db, port 5432, user postgres and that same password.",{"type":77,"body":78},"tip","For high availability, deploy a second VPS in physical streaming replication (`primary_conninfo` + replication slot). You get a warm standby ready to fail over, and you can offload your heavy read queries to it (`hot_standby = on`) to relieve the primary. Combined with `pgBackRest` for differential incremental backups, you reach an RPO of a few minutes without depending on a managed service.",{"type":77,"title":80,"body":81},"The official documentation","For advanced configuration, tool-specific options and version changes, refer to the \u003Ca href=\"https:\u002F\u002Fwww.postgresql.org\u002Fdocs\u002F\" target=\"_blank\" rel=\"noopener noreferrer\">official PostgreSQL documentation\u003C\u002Fa>. This guide covers going live on a ServOrbit VPS; the vendor documentation remains the reference for fine tuning.","Deploy your PostgreSQL in minutes","Launch a ServOrbit Cloud VPS with a preconfigured Docker template, NVMe SSD and dedicated CPU: the ideal environment to host PostgreSQL without per-GB billing.","Configure my Cloud VPS","\u002Fvps-cloud",[87,101,116],{"id":88,"slug":89,"slugs":90,"title":93,"excerpt":94,"readTime":95,"views":15,"isPinned":16,"publishedAt":96,"category":97,"categories":98,"featuredImage":26,"bgImage":27,"posterImage":100,"relatedSolution":26},57,"hosting-mysql-on-a-vps",{"fr":91,"en":89,"ar":92},"heberger-mysql-vps","استضافة-mysql-على-خادم-vps","Hosting MySQL on a VPS","Host MySQL on your Cloud VPS: Docker deployment, hardening, InnoDB tuning, and automated backups, step by step.",3,"2026-04-24T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[99],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fheberger-mysql-vps-poster.svg",{"id":102,"slug":103,"slugs":104,"title":107,"excerpt":108,"readTime":14,"views":15,"isPinned":16,"publishedAt":109,"category":110,"categories":111,"featuredImage":26,"bgImage":27,"posterImage":113,"relatedSolution":114},58,"hosting-redis-on-a-vps",{"fr":105,"en":103,"ar":106},"heberger-redis-vps","استضافة-redis-على-خادم-vps","Hosting Redis on a VPS","Deploy Redis on your Cloud VPS: in-memory cache, sessions, and queues, with persistence, security, and tuning.","2026-04-23T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[112],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fheberger-redis-vps-poster.svg",{"categorySlug":30,"appSlug":115},"redis-stack",{"id":117,"slug":118,"slugs":119,"title":122,"excerpt":123,"readTime":95,"views":15,"isPinned":16,"publishedAt":124,"category":125,"categories":126,"featuredImage":26,"bgImage":27,"posterImage":128,"relatedSolution":26},59,"hosting-mongodb-on-a-vps",{"fr":120,"en":118,"ar":121},"heberger-mongodb-vps","استضافة-mongodb-على-خادم-vps","Hosting MongoDB on a VPS","Host MongoDB on your Cloud VPS: Docker deployment, replica set, authentication, indexing, and controlled backups.","2026-04-22T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[127],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fheberger-mongodb-vps-poster.svg",1787581011097]