2.2 KiB
Local setup
This guide shows the shortest safe path for running gramsrv on a development machine or a small test server.
1. Prepare local configuration
The repository intentionally tracks only .env.example. Your real .env is
ignored by Git and must not be committed.
Linux / macOS:
cp .env.example .env
${EDITOR:-nano} .env
Windows PowerShell:
Copy-Item .env.example .env
notepad .env
If you prefer a different config filename, set TELESRV_CONFIG as a process
environment variable before starting the server.
2. Set the network values
Review at least these values in .env:
TELESRV_LISTENis the MTProto bind address. Use0.0.0.0:2398when external clients must connect to this host, or127.0.0.1:2398for same-machine testing only.TELESRV_ADVERTISE_IPmust be a client-reachable IPv4 or IPv6 address, not a DNS name. Use127.0.0.1only when the patched client runs on the same machine. Use a LAN or public IP for phones, other computers, or remote tests.TELESRV_PUBLIC_BASE_URLandTELESRV_PUBLIC_WEB_BASE_URLare HTTP(S) URLs used in generated public links. Put hostnames here, not inTELESRV_ADVERTISE_IP.TELESRV_DEV_AUTH_CODE=12345is convenient for local development but must not be exposed as a production login code.
3. Start Postgres and Redis
The development compose file exposes Postgres on 127.0.0.1:5432 and Redis on
127.0.0.1:6399, matching the defaults in .env.example.
docker compose -f deploy/docker-compose.yml up -d
If you use external Postgres or Redis, update TELESRV_POSTGRES_DSN and
TELESRV_REDIS_ADDR in .env.
4. Build and run the server
Linux / macOS:
go build -o bin/gramsrv ./cmd/telesrv
./bin/gramsrv
Windows PowerShell:
go build -o bin/gramsrv.exe ./cmd/telesrv
.\bin\gramsrv.exe
5. First-start checklist
After startup, confirm:
- migrations completed successfully;
data/server_rsa.pemwas created if it did not already exist;- MTProto is listening on
TELESRV_LISTEN; - Postgres and Redis connections are healthy;
- patched clients use the matching DC address, port, and server RSA key.
For the complete configuration reference, see
docs/configuration.en.md.