The pgrok is built and runs as a single binary and meant to be cross platform. Therefore, you should be able to develop pgrok in any major platforms you prefer. However, this guide will focus on macOS only.
The development of pgrok has the following dependencies:
- Git (v2 or higher)
- Go (v1.20 or higher)
- pnpm (v8 or higher)
- Task (v3)
- Overmind (v2)
- PostgreSQL (v10 or higher)
-
Install Homebrew.
-
Install dependencies:
brew install git go pnpm go-task overmind postgresql@15
-
Configure PostgreSQL to start automatically:
brew services start postgresql@15
-
Ensure
psql
, the PostgreSQL command line client, is on your$PATH
.
You need a fresh Postgres database and a database user that has full ownership of that database.
-
Create a database for the current Unix user:
createdb
-
Create the user and password:
createuser --superuser pgrokd psql -c "ALTER USER pgrokd WITH PASSWORD 'pgrokd';"
-
Create the database:
createdb --owner=pgrokd --encoding=UTF8 --template=template0 pgrokd
Generally, you don't need a full clone, so set --depth
to 10
:
# HTTPS
git clone --depth 10 https://github.com/pgrok/pgrok.git
# or SSH
git clone --depth 10 git@github.com:pgrok/pgrok.git
Note
The repository has Go modules enabled, please clone to somewhere outside of your $GOPATH
.
Create a pgrokd.yml
file under the repository root and put the following configuration:
external_url: "http://localhost:3320"
web:
port: 3320
proxy:
port: 3000
scheme: "http"
domain: "localhost:3000"
sshd:
port: 2222
database:
host: "localhost"
port: 5432
user: "pgrokd"
password: "pgrokd"
database: "pgrokd"
identity_provider:
type: "oidc"
display_name: "OIDC"
issuer: "http://localhost:9833"
client_id: "winnerwinner"
client_secret: "chickendinner"
field_mapping:
identifier: "email"
display_name: "name"
email: "email"
The following command will start processes defined in the Procfile
and automatically recompile and restart these servers if related files are changed:
overmind start
Then, visit http://localhost:3320!
Few things to note:
- The web, proxy and SSHD servers of the pgrokd are started
- No need to access the Vite server for the pgrokd web app as all requests to it are proxyed by the pgrokd web server
- A mock OIDC server is started for your convenience