Skip to content

Commit 1f1195a

Browse files
committed
Change how ngrok is being used again, and update DEVELOPMENT instructions
1 parent 96cd333 commit 1f1195a

File tree

7 files changed

+76
-37
lines changed

7 files changed

+76
-37
lines changed

.docker/pizzly-server.env.example

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
SERVER_HOST=http://localhost
2-
SERVER_PORT=3004
3-
NODE_ENV=development
4-
NANGO_DB_HOST=db
5-
NANGO_DB_USER=postgres
6-
NANGO_DB_PASSWORD=postgres
7-
NANGO_DB_NAME=postgres
1+
AUTH_CALLBACK_URL=https://<ngrok subdomain>.eu.ngrok.io/oauth/callback

.docker/pizzly_proxy.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

.docker/webapp_proxy.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

DEVELOPMENT.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,55 +37,64 @@ export PULSAR_CPP_DIR=/opt/homebrew/Cellar/libpulsar/3.1.0
3737
```bash
3838
pnpm install
3939
```
40-
2. Environment variables. You will need to create copies of the `.env.example` files in `app/webapp`
40+
2. Optionally, if you are testing auth (pizzly) or webhooks (webapp) then you'll need to use ngrok to proxy internet traffic to your local machine
41+
42+
Get access to ngrok and then follow the instructions here to get it setup: https://ngrok.com/download (use homebrew) and make sure to authenticate.
43+
44+
Then run the following scripts to start proxying:
45+
46+
```sh
47+
./scripts/proxy-pizzly.sh dan-pizzly-dev
48+
./scripts/proxy-webapp.sh dan-trigger-dev
49+
```
50+
51+
3. Environment variables. You will need to create copies of the `.env.example` files in `app/webapp`
4152

4253
```sh
4354
cp ./apps/webapp/.env.example ./apps/webapp/.env
4455
```
4556

4657
Then you will need to fill in the fields with real values.
4758

48-
You also need to create three `.env` files under the `.docker` directory:
59+
You also need to create the `pizzly-server.env` files under the `.docker` directory:
4960

5061
```sh
5162
cp ./.docker/pizzly-server.env.example ./.docker/pizzly-server.env
52-
cp ./.docker/pizzly_proxy.env.example ./.docker/pizzly_proxy.env
53-
cp ./.docker/webapp_proxy.env.example ./.docker/webapp_proxy.env
5463
```
5564

56-
In `webapp_proxy` and `pizzly_proxy` make sure you fill in the `NGROK_SUBDOMAIN` and `NGROK_AUTH` environment variables. For example, in `webapp_proxy` and `pizzly_proxy` you could have something like `dan-trigger-dev` and `dan-pizzly-dev` respectively for the `NGROK_SUBDOMAIN` env var.
65+
Next, update the `AUTH_CALLBACK_URL` env var in the `pizzly-server.env` env file with the value provided to the `./scripts/proxy-pizzly.sh` command. Using the example above the `AUTH_CALLBACK_URL` would be `AUTH_CALLBACK_URL=https://dan-pizzly-dev.eu.ngrok.io/oauth/callback`.
5766

58-
Next, update the `SERVER_HOST` env var in the `pizzly-server.env` env file with the value provided to the `NGROK_SUBDOMAIN` in the `pizzly_proxy.env` file. Using the example above the `SERVER_HOST` would be `SERVER_HOST=https://dan-pizzly-dev.ngrok.io`
67+
If you aren't proxying pizzly according to step 2, then leave the `pizzly-server.env` file empty.
5968

60-
Also, in `webapp/.env`, set the `APP_ORIGIN` to the `NGROK_SUBDOMAIN` provided to the `webapp_proxy.env` file, e.g. `APP_ORIGIN=https://dan-trigger-dev.ngrok.io`
69+
If you are proxying the webapp accroding to step 2 then in `webapp/.env`, set the `APP_ORIGIN` to the `NGROK_SUBDOMAIN` provided to the `./scripts/proxy-webapp.sh` command, e.g. `APP_ORIGIN=https://dan-trigger-dev.eu.ngrok.io`
6170

62-
3. Start postgresql, pulsar, pizzly server, and the two ngrok proxies
71+
4. Start postgresql, pulsar, and pizzly server
6372

6473
```bash
6574
pnpm run docker:db
6675
```
6776

6877
> **Note:** The npm script will complete while Docker sets up the container in the background. Ensure that Docker has finished and your container is running before proceeding.
6978
70-
4. Generate prisma schema
79+
5. Generate prisma schema
7180
```bash
7281
pnpm run generate
7382
```
74-
5. Run the Prisma migration to the database
83+
6. Run the Prisma migration to the database
7584

7685
```bash
7786
pnpm run db:migrate:deploy
7887
```
7988

80-
6. Run the first build (with dependencies via the `...` option)
89+
7. Run the first build (with dependencies via the `...` option)
8190

8291
```bash
8392
pnpm run build --filter=webapp...
8493
```
8594

8695
**Running simply `pnpm run build` will build everything, including the Remix app.**
8796

88-
7. Run the Remix dev server
97+
8. Run the Remix dev server
8998

9099
```bash
91100
pnpm run dev --filter=webapp

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ services:
2626
restart: always
2727
env_file:
2828
- .docker/pizzly-server.env
29+
environment:
30+
- SERVER_HOST=http://localhost
31+
- SERVER_PORT=3004
32+
- NODE_ENV=development
33+
- NANGO_DB_HOST=db
34+
- NANGO_DB_USER=postgres
35+
- NANGO_DB_PASSWORD=postgres
36+
- NANGO_DB_NAME=postgres
2937
ports:
3038
- "3004:3004"
3139
depends_on:
3240
- db
3341
networks:
3442
- app_network
35-
pizzly_proxy:
36-
image: wernight/ngrok
37-
env_file:
38-
- .docker/pizzly_proxy.env
39-
webapp_proxy:
40-
image: wernight/ngrok
41-
env_file:
42-
- .docker/webapp_proxy.env
4343
pulsar:
4444
image: apachepulsar/pulsar:2.10.2
4545
ports:

scripts/proxy-pizzly.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -e -x
22+
23+
ngrok http --subdomain=${1:-$NGROK_SUBDOMAIN} --region eu 3004

scripts/proxy-webapp.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -e -x
22+
23+
ngrok http --subdomain=${1:-$NGROK_SUBDOMAIN} --region eu 3000

0 commit comments

Comments
 (0)