P2 DOCS
TREN
DOWNLOAD SERVER
SERVER ADMIN // v1.0.9

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.

ComponentRole
p2-serverThe 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.
WindowsLinux
Operating systemWindows 10/11 x64 or Windows Server 2022+Ubuntu Server 24.04 LTS or newer, x86-64
Memory / diskAt least 2 GB RAMAt least 2 GB RAM, 10 GB disk
RightsAdministrator accountsudo

No Node.js or other runtime is needed.

The P2 Server Console is currently in Turkish only. This guide gives each Turkish label with its meaning.

2. Windows installation

01

Install PostgreSQL

Install PostgreSQL 15 or newer with the official Windows installer; keep the password of the postgres user.

02

Install P2 Server

Download and run P2-Server-Setup-1.0.9.exe (see the SmartScreen note below). Default folder: %LOCALAPPDATA%\Programs\P2 Server.

03

Open the console

P2 Server from the Start menu or desktop.

04

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).

05

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.

06

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:

01

More info

Click More info in the warning window.

02

Check the file

Make sure the file is named P2-Server-Setup-…exe and that you downloaded it only from p2.tdagaming.net.

03

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.

Step-by-step guide: Windows server installation.

Where files live on Windows

PathContents
%LOCALAPPDATA%\Programs\P2 ServerProgram files (C:\Program Files\P2 Server with /allusers)
%ProgramData%\P2\server.jsonDatabase connection, API port, session secrets
%ProgramData%\P2\server.logServer log (service logs are in this folder too, 10 MB × 4)
%ProgramData%\P2\uploadsUploaded files
%ProgramData%\P2\releasesLibrary releases
%ProgramData%\P2\backupsBackups 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 p2 role 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.

PathContents
/opt/p2-server/p2-serverProgram
/etc/p2-server/p2-server.envConfiguration (0600)
/var/lib/p2-server/{uploads,releases,updates,backups}Data
/usr/local/sbin/p2-serverctlManagement command
Full guide including Caddy: Ubuntu server installation.

p2-serverctl commands

CommandWhat it does
sudo p2-serverctl statusService status
sudo p2-serverctl start | stop | restartStart / stop / restart
sudo p2-serverctl logs [N]Last N log lines and follow (default 150)
sudo p2-serverctl migrateApply database migrations manually
sudo p2-serverctl backup [FILE]Create a backup
sudo p2-serverctl restore FILERestore 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

PortUseExpose to the internet?
TCP 4000 (configurable)API, realtime connection, files, updates — all on one portNo; keep it behind the reverse proxy
TCP 5432PostgreSQLNever
TCP 80 / 443Reverse 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).

Voice and video calls connect people directly; the server opens no UDP ports and includes no TURN server. On very strict networks (corporate firewalls, symmetric NAT) calls may fail to connect.

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)

FieldDefault
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.

TabContents
OverviewUsers, banned, projects, deleted projects, open sessions, channels, online; version and rules
UsersSearch (name, username, email); Sign out everywhere, Reset 2FA, Ban from server (optional reason), lift ban, server permissions
ProjectsEvery project; Enter project, Transfer ownership, Delete project, Restore, Delete forever (only from the recycle bin)
SettingsServer 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

PermissionWhat it allows
Create projectsCan open new projects
View everythingSees every project, including ones they are not in
Manage usersSigns people out and resets 2FA
Ban usersBans and unbans people
Manage projectsEnters, transfers, deletes and restores any project
Server settingsServer name, sign-up and project rules
Server adminEvery server permission; can grant permissions
If a user forgets their password: P2 has no email reset. For someone who lost their 2FA device, use Reset 2FA. For project roles and channel permissions see User guide › Project admin.

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.

VariableDefaultMeaning
DATABASE_URLrequiredPostgreSQL connection; sslmode=require supported
JWT_ACCESS_SECRETrequiredSession secret (random at install; changing it signs everyone out)
JWT_REFRESH_SECRETrequiredLong-lived session secret
HOST0.0.0.0Bind address
PORT4000API port
P2_SERVER_DATA_DIRWindows %ProgramData%\P2, Linux /var/lib/p2-serverData folder
P2_UPLOAD_DIR<data>/uploadsUploaded files
P2_RELEASE_DIR<data>/releasesLibrary releases
P2_UPDATE_DIR<data>/updatesUpdate files
P2_PG_BIN—Folder with pg_dump/pg_restore (if backups can't find them)
Backups only include the uploads and releases folders inside the data folder. If you move them elsewhere, back them up separately.

Limits

Limit
Message attachment250 MB per file
Profile photo / project icon8 MB
Cover image15 MB
Library release200,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.

AccessIn the listJoining
Open (public)Shown, with its addressPick and join
PrivateShown, address hiddenNeeds 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 / keyMeaning
[server] name, descriptionName and description shown in the browser
[server] iconIcon: a path relative to the data folder (png, jpg, webp; square recommended) or an https URL
[server] public_urlThe address clients connect to, e.g. https://p2.example.com. Required to be listed
[server] accesspublic or private
[server] access_codeJoin code for a private server
[directory] listShow in the browser (true/false); with false the server removes itself from the directory
[directory] urlDirectory address (default: the central P2 server)
[turn] urls, secret, ttlTURN settings (section 9)
[identity] id, keyThe 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.

PortProtocolPurpose
3478UDP + TCPTURN/STUN
49160–49260UDPRelay ports
Forward these ports from your router to the server (nothing else to do if the server is the DMZ host). After setup, the client log shows "… ICE servers received from the server (TURN present)" during calls.

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
WindowsWhile 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.
LinuxExtract 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 upRestore
WindowsConsole › Yedek alConsole › Yedek yükle
Linuxsudo p2-serverctl backupsudo 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

01

Back up the old server

Copy the .p2backup file to the new machine.

02

Install the new server

Install P2 Server and configure the PostgreSQL connection.

03

Restore

Yedek yükle in the console, or p2-serverctl restore.

04

Update the address

Point your domain's DNS record at the new machine.

Keep backups encrypted and off the server. 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)
Linuxsudo p2-serverctl logs or journalctl -u p2-server.service

Health check: curl http://127.0.0.1:4000/health → {"status":"ok","version":"…"}.

SymptomFix
"Ö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 ECONNREFUSEDPostgreSQL isn't running or the host/port is wrong. Check services.msc or systemctl status postgresql.
password authentication failedWrong 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 failedApprove the admin prompt; P2ServerService.xml must be in the install folder (re-run the installer if needed).
Clients can't connectTry the health check on the server, then check the reverse proxy, DNS and port 443 forwarding.
A user lost their 2FA deviceServer admin › Users › Reset 2FA.

Help: Support center · Source code and issues: GitHub.