Pages
Selfhosting
Information on selfhosting Env Tree
Depending on your requirements you may wish to selfhost Env Tree, this documentation covers setup and possible configuration options for a self hosted enviroment
With Railway
To host with railway please use the template
At least one method of authentication must be provided
GitHub Authentication
Callback url must be set to
https://<railway url>/api/auth/callback/github
GitLab Authentication
Callback url must be set to
https://<railway url>/api/auth/callback/gitlab
Required scopes must be at least
read_user
With Docker
To the basic setup will use the docker image provided with Github and Gitlab authentication options.
- Pull the docker image
docker pull ghcr.io/maxs-rose/env-tree
- Create a
.env
file containing the configuration for your selfhosted enviroment:DATABASE_URL=postgresql://<postgresurl>
CONFIG_ENCRYPTION_SECRET=<secret>
GITHUB_ID=<id>
GITHUB_SECRET=<secret>
GITLAB_ID=<id>
GITLAB_SECRET=<secret>
NEXTAUTH_URL=<url>
NEXTAUTH_SECRET=<secret>
CONFIG_AUDIT_RETENTION=<integer> # Default 0
- Start the container
docker run -d --name env-tree -p 3000:3000 --env-file .env ghcr.io/maxs-rose/env-tree
At least one method of authentication must be provided
GitHub Authentication
Callback url must be set to
https://<url>/api/auth/callback/github
GitLab Authentication
Callback url must be set to
https://<url>/api/auth/callback/gitlab
Required scopes must be at least
read_user
Advanced Setup: Building from Source
To build and run Env Tree from source:
- Clone the repo
- Run
yarn install
- Under
apps > cloud
create a.env
file with the following settings:DATABASE_URL=postgresql://<postgresurl>
CONFIG_ENCRYPTION_SECRET=<secret>
GITHUB_ID=<id>
GITHUB_SECRET=<secret>
GITLAB_ID=<id>
GITLAB_SECRET=<secret>
NEXTAUTH_URL=<url>
NEXTAUTH_SECRET=<secret>
CONFIG_AUDIT_RETENTION=<integer> # Default 0
- Run
yarn prisma generate
- Run
yarn build --filter cloud
- Finally to start the application run
yarn start --filter cloud
Note: This is also applicable to development setups
Altering Authentication Providers
If you wish to alter the available login providers this can be done by editing apps > cli > cloud > src > pages > api > auth > [...nextauth].ts
then editing the getProviders
function.
Please refer to the Next Auth documentation for configuration of this section
Advanced Setup: Altering default CLI url
If you also wish to edit the node CLI to default to your selfhosted url:
- Edit
index.ts
inapps > cli > src > utils > consts.ts
- Replace
defaultUrl = 'https://secrets-production.up.railway.app/'
with your custom URL - Run
yarn build --filter cli
- You can now publish your custom cli to your selfhosted/private package repo