P2 SERVER ADMINISTRATION
Everything you need to install, configure, update and back up P2 Server.
1. Overview
P2 Server is your own server that holds all of your team's data: accounts, projects, messages, uploaded files, tasks, documents and the game builds in the Library. Voice and video flow directly between people (WebRTC); the server only sets up the connection.
| Component | Role |
|---|---|
p2-server | The API server: REST, realtime connection, files, library and update distribution. One port (default 4000). |
| P2 Server Console (Windows only) | Graphical console: PostgreSQL settings, start/stop, Windows service, backups, live log. |
| PostgreSQL 15+ | The database. Installed separately (the Linux script installs it for you). |
| Reverse proxy (Caddy / Nginx) | Recommended for HTTPS access from the internet. |
| Windows | Linux | |
|---|---|---|
| Operating system | Windows 10/11 x64 or Windows Server 2022+ | Ubuntu Server 24.04 LTS or newer, x86-64 |
| Memory / disk | At least 2 GB RAM | At least 2 GB RAM, 10 GB disk |
| Rights | Administrator account | sudo |
No Node.js or other runtime is needed.
2. Windows installation
Install PostgreSQL
Install PostgreSQL 15 or newer with the official Windows installer; keep the password of the postgres user.
Install P2 Server
Download and run P2-Server-Setup-1.0.9.exe (see the SmartScreen note below). Default folder: %LOCALAPPDATA%\Programs\P2 Server.
Open the console
P2 Server from the Start menu or desktop.
Connect the database
In the PostgreSQL yapılandırması (PostgreSQL configuration) card: host 127.0.0.1, port 5432, user postgres, database p2, your password and API port 4000. Click Kaydet, tabloları hazırla ve başlat (Save, prepare tables and start).
Register the service
When the status shows Çalışıyor (Running), click Windows servisi olarak kaydet (Register as Windows service) and approve the admin prompt. The server now starts at boot without anyone signing in.
Create the first admin
Connect with P2 Client; the first person to connect creates the first admin account.
The Windows "protected your PC" warning
The P2 Server installer does not have a commercial code-signing certificate yet, so Windows SmartScreen may show a blue warning the first time you run it:
More info
Click More info in the warning window.
Check the file
Make sure the file is named P2-Server-Setup-…exe and that you downloaded it only from p2.tdagaming.net.
Run anyway
Click Run anyway; setup starts.
Optionally verify the download with SHA-256 (PowerShell):
Get-FileHash .\P2-Server-Setup-1.0.9.exe -Algorithm SHA256
The value must match the one in the .sha256 file on the download page.
Where files live on Windows
| Path | Contents |
|---|---|
%LOCALAPPDATA%\Programs\P2 Server | Program files (C:\Program Files\P2 Server with /allusers) |
%ProgramData%\P2\server.json | Database connection, API port, session secrets |
%ProgramData%\P2\server.log | Server log (service logs are in this folder too, 10 MB × 4) |
%ProgramData%\P2\uploads | Uploaded files |
%ProgramData%\P2\releases | Library releases |
%ProgramData%\P2\backups | Backups made from the command line |
Uninstalling or reinstalling never touches %ProgramData%\P2 or the service registration; your data is kept.
3. Linux (Ubuntu) installation
tar -xzf P2-Server-Ubuntu-24.04-x64-1.0.9.tar.gz cd P2-Server-Ubuntu-24.04-x64-1.0.9 sudo bash install.sh
The script installs PostgreSQL and creates the p2server system user, the folders and the p2-server.service systemd unit. On first install it asks:
- Use PostgreSQL on this machine? [E/h] (E = yes, h = no): yes asks for a password and creates the
p2role and database; no asks for a full PostgreSQL connection URL. - P2 API port [4000].
Upgrades keep the database, port and secrets; only the program changes.
| Path | Contents |
|---|---|
/opt/p2-server/p2-server | Program |
/etc/p2-server/p2-server.env | Configuration (0600) |
/var/lib/p2-server/{uploads,releases,updates,backups} | Data |
/usr/local/sbin/p2-serverctl | Management command |
p2-serverctl commands
| Command | What it does |
|---|---|
sudo p2-serverctl status | Service status |
sudo p2-serverctl start | stop | restart | Start / stop / restart |
sudo p2-serverctl logs [N] | Last N log lines and follow (default 150) |
sudo p2-serverctl migrate | Apply database migrations manually |
sudo p2-serverctl backup [FILE] | Create a backup |
sudo p2-serverctl restore FILE | Restore a backup (type RESTORE to confirm) |
To remove, run sudo bash uninstall.sh from the package; /var/lib/p2-server and /etc/p2-server are kept on purpose.
4. Network, domain and HTTPS
| Port | Use | Expose to the internet? |
|---|---|---|
| TCP 4000 (configurable) | API, realtime connection, files, updates — all on one port | No; keep it behind the reverse proxy |
| TCP 5432 | PostgreSQL | Never |
| TCP 80 / 443 | Reverse proxy (HTTPS) | Yes |
The server has no built-in TLS; use Caddy (recommended, it gets certificates by itself) or Nginx for HTTPS. Caddy example:
p2.example.com {
reverse_proxy 127.0.0.1:4000
}
Point your domain's DNS record at the server's IP and forward only ports 80 and 443 on your router. Give clients https://p2.example.com.
For a local network only, no reverse proxy is needed: clients connect to http://<server-ip>:4000 (you may need to allow port 4000 in Windows Firewall; setup does not add firewall rules).
5. P2 Server Console (Windows)
The console runs as a single window; launching it again brings the existing window forward. Closing the console does not stop the server.
Sunucu durumu (Server status)
- PUBLIC İSTEMCİ BAĞLANTI ADRESİ (public client address):
http://<public-ip>:<port>and Kopyala (Copy). If you use a domain, give clients your HTTPS address instead. - Başlat (Start), Yeniden başlat (Restart), Durdur (Stop), Veri klasörü (Data folder,
%ProgramData%\P2), Güncelleme denetle (Check for updates). - Tiles: P2 Server sürümü (version), API portu, Yapılandırma (configuration: Hazır = ready / Bekliyor = waiting), Windows servisi (Kayıtlı = registered / Kayıtlı değil = not registered).
- Windows servisi olarak kaydet (Register as Windows service) / Servisi kaldır (Remove service) — needs admin rights.
- Red line: the last error in the log.
PostgreSQL yapılandırması (PostgreSQL configuration)
| Field | Default |
|---|---|
| PostgreSQL adresi (host) | 127.0.0.1 |
| PostgreSQL portu (port) | 5432 |
| Kullanıcı (user) | postgres |
| Veritabanı (database) | p2 (lower case, starts with a letter) |
| PostgreSQL parolası (password) | — |
| API portu (API port) | 4000 |
| SSL kullan (use SSL) | Off (applies to the database connection only) |
Kaydet, tabloları hazırla ve başlat creates the database if missing, prepares the tables, saves the settings and restarts the server. The password is stored only in server.json on this machine.
Yedekleme ve taşıma (Backup and migration)
Yedek al (Create backup) puts the database and uploaded files into a single .p2backup file. Tick Yedeğe kütüphane sürüm dosyalarını da ekle to include library builds as well (can be very large). Yedek yükle (Restore backup) replaces the current database with the selected backup; the server stops meanwhile and the old uploads folder is moved to a dated folder rather than deleted.
Güncelleme dağıtımı ve canlı günlük (Updates and live log)
Shows the data folder, the CLIENT UPDATE URL and the last 120 lines of server.log.
6. Server admin (in the client)
Server-wide settings live in the Server admin panel inside P2 Client (shield icon on the left rail), visible to anyone with a server permission. The installation owner (first admin) has every permission and cannot be changed or banned.
| Tab | Contents |
|---|---|
| Overview | Users, banned, projects, deleted projects, open sessions, channels, online; version and rules |
| Users | Search (name, username, email); Sign out everywhere, Reset 2FA, Ban from server (optional reason), lift ban, server permissions |
| Projects | Every project; Enter project, Transfer ownership, Delete project, Restore, Delete forever (only from the recycle bin) |
| Settings | Server name (2–60 characters); Sign-up: Open / Invite only; Project creation: Everyone / Only with permission |
- A banned user can't sign in; their sessions and connections close immediately. Project memberships are kept.
- With Invite only sign-up, a project invite code is needed to create an account.
- Deleted projects stay in the recycle bin for 30 days.
Server permissions
| Permission | What it allows |
|---|---|
| Create projects | Can open new projects |
| View everything | Sees every project, including ones they are not in |
| Manage users | Signs people out and resets 2FA |
| Ban users | Bans and unbans people |
| Manage projects | Enters, transfers, deletes and restores any project |
| Server settings | Server name, sign-up and project rules |
| Server admin | Every server permission; can grant permissions |
7. Configuration keys
On Windows the settings are in %ProgramData%\P2\server.json, written by the console. On Linux they are in /etc/p2-server/p2-server.env; run sudo p2-serverctl restart after editing.
| Variable | Default | Meaning |
|---|---|---|
DATABASE_URL | required | PostgreSQL connection; sslmode=require supported |
JWT_ACCESS_SECRET | required | Session secret (random at install; changing it signs everyone out) |
JWT_REFRESH_SECRET | required | Long-lived session secret |
HOST | 0.0.0.0 | Bind address |
PORT | 4000 | API port |
P2_SERVER_DATA_DIR | Windows %ProgramData%\P2, Linux /var/lib/p2-server | Data folder |
P2_UPLOAD_DIR | <data>/uploads | Uploaded files |
P2_RELEASE_DIR | <data>/releases | Library releases |
P2_UPDATE_DIR | <data>/updates | Update files |
P2_PG_BIN | — | Folder with pg_dump/pg_restore (if backups can't find them) |
uploads and releases folders inside the data folder. If you move them elsewhere, back them up separately.Limits
| Limit | |
|---|---|
| Message attachment | 250 MB per file |
| Profile photo / project icon | 8 MB |
| Cover image | 15 MB |
| Library release | 200,000 files, 200 GB |
Library drafts untouched for 7 days and unused chunks are cleaned up by the server every 6 hours.
8. Server browser and p2-server.ini
P2 users see every P2 Server that chose to be listed in the app's Server browser. Your server announces itself to the central directory (https://p2.tdagaming.net) every 5 minutes and whenever its settings change; the directory checks that this server really runs at the announced address.
| Access | In the list | Joining |
|---|---|---|
| Open (public) | Shown, with its address | Pick and join |
| Private | Shown, address hidden | Needs the join code; new members also enter it when signing up (except people coming with a project invite code) |
Settings
Settings live in p2-server.ini in the data folder (Windows %ProgramData%\P2, Linux /var/lib/p2-server). The file is created on first start. Changes made while the server runs apply within seconds without a restart; you can also edit it while the server is stopped.
| Section / key | Meaning |
|---|---|
[server] name, description | Name and description shown in the browser |
[server] icon | Icon: a path relative to the data folder (png, jpg, webp; square recommended) or an https URL |
[server] public_url | The address clients connect to, e.g. https://p2.example.com. Required to be listed |
[server] access | public or private |
[server] access_code | Join code for a private server |
[directory] list | Show in the browser (true/false); with false the server removes itself from the directory |
[directory] url | Directory address (default: the central P2 server) |
[turn] urls, secret, ttl | TURN settings (section 9) |
[identity] id, key | The browser identity; don't change (if deleted a new one is generated and the old listing drops) |
Windows
The Server browser card in P2 Server Console has name, public address, description, icon (Simge seç… copies the file into the data folder), list in the server browser, private server (join with code) with the join code, and the TURN fields. Kaydet writes the file.
Linux
sudo p2-serverctl settings # opens p2-server.ini in an editor sudo p2-serverctl icon icon.png # copies and sets the icon
9. TURN for voice calls
Voice and video flow directly between people. When both sides are behind strict NAT (e.g. mobile carriers or some routers) a direct connection can't be made; audio then goes through the TURN relay (coturn) on your server. P2 Server hands every user a short-lived TURN credential; users don't configure anything.
Setup on Linux
sudo p2-serverctl turn-setup p2.example.com
This installs coturn, generates a random secret, configures and starts coturn, opens the ports if ufw is active and fills the [turn] section of p2-server.ini.
| Port | Protocol | Purpose |
|---|---|---|
| 3478 | UDP + TCP | TURN/STUN |
| 49160–49260 | UDP | Relay ports |
Windows or another TURN server
Run coturn with use-auth-secret and static-auth-secret=<secret>, then enter the addresses (e.g. turn:p2.example.com:3478?transport=udp, …?transport=tcp) and the same secret in the TURN fields of P2 Server Console and click Kaydet.
10. Updating
| How | |
|---|---|
| Windows | While the console is open it checks for updates (at start and every 5 minutes), downloads, stops the server, installs and reopens. Manually: run the new P2-Server-Setup over the old one; settings, data and the service are kept. |
| Linux | Extract the new package and run sudo bash install.sh. Configuration and data are kept. |
Database migrations run automatically when the server starts. Take a backup before updating.
Client updates
P2 Client installed from the Microsoft Store (Play Through) updates through the Store. Clients installed with the old installer get updates from the server they connect to: the files live under updates/client in the data folder (<address>/updates/client/latest.yml).
11. Backup and migration
| Back up | Restore | |
|---|---|---|
| Windows | Console › Yedek al | Console › Yedek yükle |
| Linux | sudo p2-serverctl backup | sudo p2-serverctl restore FILE |
A .p2backup file contains the database and uploaded files; library builds are only included when ticked in the console (command-line backups don't include them). If PostgreSQL tools can't be found, a portable JSON database dump is used.
Moving to another machine
Back up the old server
Copy the .p2backup file to the new machine.
Install the new server
Install P2 Server and configure the PostgreSQL connection.
Restore
Yedek yükle in the console, or p2-serverctl restore.
Update the address
Point your domain's DNS record at the new machine.
server.json and p2-server.env contain the database password and session secrets; never share them.12. Logs and troubleshooting
| Log | |
|---|---|
| Windows | %ProgramData%\P2\server.log (also shown in the console's bottom card) |
| Linux | sudo p2-serverctl logs or journalctl -u p2-server.service |
Health check: curl http://127.0.0.1:4000/health → {"status":"ok","version":"…"}.
| Symptom | Fix |
|---|---|
| "Önce PostgreSQL bağlantısını yapılandırın." (configure PostgreSQL first) | Fill in and save the PostgreSQL card in the console (Linux: DATABASE_URL in the env file). |
connect ECONNREFUSED | PostgreSQL isn't running or the host/port is wrong. Check services.msc or systemctl status postgresql. |
password authentication failed | Wrong PostgreSQL password. |
| "pg_dump bulunamadı" (pg_dump not found) | Install the PostgreSQL client tools or set P2_PG_BIN to their bin folder. |
| Service registration failed | Approve the admin prompt; P2ServerService.xml must be in the install folder (re-run the installer if needed). |
| Clients can't connect | Try the health check on the server, then check the reverse proxy, DNS and port 443 forwarding. |
| A user lost their 2FA device | Server admin › Users › Reset 2FA. |
Help: Support center · Source code and issues: GitHub.