Skip to content

Commit b91eb5e

Browse files
committed
Clean up and document env vars
1 parent ff0016d commit b91eb5e

File tree

4 files changed

+37
-24
lines changed

4 files changed

+37
-24
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,43 @@ It details Share's required environment variables and shows how it expects to be
7474

7575
If you have any questions about self hosting, feel free to ask in our [Discord server](https://unison-lang.org/discord).
7676

77+
### Dependencies
78+
79+
Share currently requires a Postgres instance and access to a Redis server.
80+
81+
### Environment Variables
82+
83+
There are a number of environment variables Share requires.
84+
See `local.env` for example values which are used for local development.
85+
86+
- `SHARE_API_ORIGIN`: The URL where the share server is accessible on the web.
87+
- `SHARE_SERVER_PORT`: Which port the server should bind to on startup. This may differ from `SHARE_API_ORIGIN` if you're using a reverse proxy.
88+
- `SHARE_REDIS`: The URL of the redis server.
89+
- `SHARE_POSTGRES`: The URL of the postgres server.
90+
- `SHARE_HMAC_KEY`: A secret key used for cryptographic signing. This should be at least 32 characters long.
91+
- `SHARE_DEPLOYMENT`: The deployment environment. One of: `local`, `staging`, `prod`.
92+
- `SHARE_POSTGRES_CONN_TTL`: The maximum time a connection to the postgres server should be kept alive.
93+
- `SHARE_POSTGRES_CONN_MAX`: The maximum number of connections to the postgres server.
94+
- `SHARE_SHARE_UI_ORIGIN`: The URL where the Share UI is publicly accessible.
95+
- `SHARE_CLOUD_UI_ORIGIN`: The URL where the Unison Cloud UI is publicly accessible.
96+
- `SHARE_HOMEPAGE_ORIGIN`: The URL where the Unison homepage is publicly accessible. If you are self-hosting you can set this to any URL you like.
97+
- `SHARE_CLOUD_HOMEPAGE_ORIGIN`: The URL where the Unison Cloud homepage is publicly accessible. If you are self-hosting you can set this to any URL you like.
98+
- `SHARE_LOG_LEVEL`: Minimum level of logging to emit, One of: `DEBUG`, `INFO`, `ERROR`, `USERERROR`.
99+
- `SHARE_COMMIT`: The git commit hash the share server was built from. This is passed along in error reports
100+
- `SHARE_MAX_PARALLELISM_PER_DOWNLOAD_REQUEST`: How many concurrent workers may serve a single UCM pull. The recommended value for this will depend on the number of cores on your machine, but between 5-8 is a reasonable number.
101+
- `SHARE_MAX_PARALLELISM_PER_UPLOAD_REQUEST`: How many concurrent workers may serve a single UCM push. The recommended value for this will depend on the number of cores on your machine, but between 5-8 is a reasonable number.
102+
- `SHARE_ZENDESK_API_USER`: The username to use for the Zendesk API.
103+
- `SHARE_ZENDESK_API_TOKEN`: The token to use for the Zendesk API.
104+
- `SHARE_GITHUB_CLIENTID`: The client ID for the GitHub OAuth application which will be used to authenticate users with the Share server.
105+
- `SHARE_GITHUB_CLIENT_SECRET`: The client secret for the GitHub OAuth application which will be used to authenticate users with the Share server.
106+
- (optional) `SHARE_SENTRY_DSN`: The URL of the Sentry instance to send error reports to. You may leave this unset.
107+
108+
### Database initialization
109+
110+
Share doesn't currently use any tools for managing database migrations (sorry). To initialize your database, you must run all the **timestamped** migration files inside `./sql`.
111+
112+
We plan to transition to a more robust solution in the future.
113+
77114
## Updating unison dependencies
78115

79116
```sh

docker/docker-compose.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,15 @@ services:
4545
retries: 3
4646
ports:
4747
- "5424:5424"
48-
- "5425:5425"
49-
- "5426:5426"
5048

5149
environment:
5250
# Placeholder values for development
5351
- SHARE_API_ORIGIN=http://share-api
5452
- SHARE_SERVER_PORT=5424
55-
- SHARE_ADMIN_PORT=5425
56-
- SHARE_CLIENT_HOSTNAME=0.0.0.0
57-
- SHARE_CLIENT_PORT=5426
5853
- SHARE_REDIS=redis://redis:6379
5954
- SHARE_POSTGRES=postgresql://postgres:sekrit@postgres:5432
6055
- SHARE_HMAC_KEY=test-key-test-key-test-key-test-key-
6156
- SHARE_DEPLOYMENT=local
62-
- SHARE_IP=share-api
63-
- SHARE_AWS_CREDENTIAL_URL=invalid
64-
- AWS_REGION=invalid
6557
- SHARE_POSTGRES_CONN_TTL=30
6658
- SHARE_POSTGRES_CONN_MAX=10
6759
- SHARE_SHARE_UI_ORIGIN=http://localhost:1234
@@ -76,8 +68,6 @@ services:
7668
- SHARE_ZENDESK_API_TOKEN=bad-password
7769
- SHARE_GITHUB_CLIENTID=invalid
7870
- SHARE_GITHUB_CLIENT_SECRET=invalid
79-
- AWS_ACCESS_KEY_ID=invalid
80-
- AWS_SECRET_ACCESS_KEY=invalid
8171

8272
links:
8373
- redis

docker/share-entrypoint.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ set -ex
44

55
echo SHARE_REDIS: "$SHARE_REDIS"
66

7-
if [ -n "$NOMAD_PORT_enlil_tcp" ]; then
8-
export SHARE_CLIENT_PORT="$NOMAD_PORT_enlil_tcp"
9-
fi
10-
11-
if [ -n "$NOMAD_IP_enlil_tcp" ]; then
12-
export SHARE_CLIENT_HOSTNAME="$NOMAD_IP_enlil_tcp"
13-
fi
14-
157
if [ -n "$NOMAD_PORT_enlil_http" ]; then
168
export SHARE_SERVER_PORT="$NOMAD_PORT_enlil_http"
179
fi

local.env

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
# Stub environment
44

55
export SHARE_DEPLOYMENT=local
6-
export SHARE_IP=share-api
76
export SHARE_API_ORIGIN=http://localhost:5424
87
export SHARE_SERVER_PORT=5424
9-
export SHARE_ADMIN_PORT=5425
10-
export SHARE_AWS_CREDENTIAL_URL="invalid"
11-
export AWS_REGION="invalid"
128
export SHARE_REDIS=redis://localhost:6379
139
export SHARE_POSTGRES=postgresql://postgres:sekrit@localhost:5432
1410
export SHARE_POSTGRES_CONN_TTL=30
@@ -28,5 +24,3 @@ export SHARE_ZENDESK_API_USER="[email protected]"
2824
export SHARE_ZENDESK_API_TOKEN="bad-password"
2925
export SHARE_GITHUB_CLIENTID="invalid"
3026
export SHARE_GITHUB_CLIENT_SECRET="invalid"
31-
export AWS_ACCESS_KEY_ID="invalid"
32-
export AWS_SECRET_ACCESS_KEY="invalid"

0 commit comments

Comments
 (0)