Skip to content

Commit 235ab90

Browse files
authored
doc: add instructions to create new reference project and run it locally (#1417)
* doc: add instructions to create new reference project and run it locally * doc: Add instruction for running tunnel * minor language improvement
1 parent ef7f112 commit 235ab90

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

references/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,85 @@ All the dependencies to the `@trigger.dev/*` packages will be both referenced in
4545
}
4646
}
4747
```
48+
49+
### Creating a New Reference Project
50+
51+
This guide assumes that you have followed the [Contributing.md](https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md#setup) instructions to set up a local trigger.dev instance. If not, please complete the setup before continuing.
52+
53+
#### Step-by-Step Instructions
54+
55+
1. **Run an HTTP tunnel**:
56+
You will need to run an HTTP tunnel to expose your local webapp, it is required for some API calls during building the image to deploy on your local instance. This is *optional* if you do not plan to test deployment on your local instance.
57+
- Download the ngrok CLI. This can be done by following the instructions on ngrok's [website](https://ngrok.com/docs/getting-started/).
58+
- Create an account on ngrok to obtain the authtoken and add it to the CLI.
59+
60+
```bash
61+
ngrok config add-authtoken <your-auth-token>
62+
```
63+
Replace the <your-auth-token> with the token you obtain from ngrok.
64+
- Run the tunnel.
65+
66+
```bash
67+
ngrok http <your-app-port>
68+
```
69+
Replace the <your-app-port> with the webapp port, default is `3030`.
70+
71+
2. **Add your tunnel URL to the env**:
72+
After running the ngrok tunnel, you will see URL in your terminal, it will look something like `https://<your-tunnel-address>.ngrok-free.app`.
73+
Replace the `APP_ORIGIN` variable with this URL in your `.env` file in the root of the trigger.dev project.
74+
75+
3. **Run the webapp on localhost**:
76+
77+
```bash
78+
pnpm run dev --filter webapp --filter coordinator --filter docker-provider
79+
```
80+
81+
4. **Build the CLI in a new terminal window**:
82+
83+
```bash
84+
# Build the CLI
85+
pnpm run build --filter trigger.dev
86+
87+
# Make it accessible to `pnpm exec`
88+
pnpm i
89+
```
90+
91+
5. **Set up a new project in the webapp**:
92+
- Open the webapp running on `localhost:3030`.
93+
- Create a new project in the webapp UI.
94+
- Go to the *Project Settings* page and copy the project reference id from there.
95+
96+
6. **Copy the hello-world project as a template**:
97+
98+
```bash
99+
cp -r references/hello-world references/<new-project>
100+
```
101+
102+
Replace `<new-project>` with your desired project name.
103+
104+
7. **Update project details**:
105+
- Open `<new-project>/package.json` and change the name field.
106+
*(Tip: Use the same name as in the webapp to avoid confusion.)*
107+
108+
- Open `<new-project>/trigger.config.ts` and update the project field with the project reference you copied from the webapp.
109+
110+
- Run `pnpm i` in your `<new-project>` directory to sync the dependencies.
111+
112+
8. **Authorize the CLI for your project**:
113+
114+
```bash
115+
pnpm exec trigger login -a http://localhost:3030 --profile local
116+
```
117+
118+
9. **Run the new project**:
119+
You can now run your project using the CLI with the following command:
120+
121+
```bash
122+
pnpm exec trigger dev --profile local
123+
```
124+
125+
You can also deploy them against your local instance with the following command:
126+
127+
```bash
128+
pnpm exec trigger deploy --self-hosted --load-image --profile local
129+
```

0 commit comments

Comments
 (0)