From b8a1f148ed82c7e174028b1f7630f5fc34a00cd2 Mon Sep 17 00:00:00 2001 From: Wackyator Date: Thu, 17 Oct 2024 22:01:19 +0530 Subject: [PATCH 1/3] doc: add instructions to create new reference project and run it locally --- references/README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/references/README.md b/references/README.md index fdb86fcbba..c261f65e71 100644 --- a/references/README.md +++ b/references/README.md @@ -45,3 +45,57 @@ All the dependencies to the `@trigger.dev/*` packages will be both referenced in } } ``` + +### Creating a New Reference Project + +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. + +#### Step-by-Step Instructions + +1. **Run the webapp on localhost**: + +``` +pnpm run dev --filter webapp --filter coordinator --filter docker-provider +``` + +2. **Build the CLI in a new terminal window**: + +``` +# Build the CLI +pnpm run build --filter trigger.dev + +# Make it accessible to `pnpm exec` +pnpm i +``` + +3. **Set up a new project in the webapp**: +- Open the webapp running on `localhost:3030`. +- Create a new project in the webapp UI. +- Go to the *Project Settings* page and copy the project reference id from there. + +4. **Copy the hello-world project as a template**: + +``` +cp -r references/hello-world references/ +``` + +Replace `` with your desired project name. + +5. **Update project details**: +- Open `/package.json` and change the name field. +*(Tip: Use the same name as in the webapp to avoid confusion.)* + +- Open `/trigger.config.ts` and update the project field with the project reference you copied from the webapp. + +6. **Authorize the CLI for your project**: + +``` +pnpm exec trigger login -a http://localhost:3030 --profile local +``` + +7. **Run the new project**: +You can now run your project using the CLI with the following command: + +``` +pnpm exec trigger dev --profile local +``` From dd2a2ac6a56e7d13b76fe0f45441f5827b5a0c15 Mon Sep 17 00:00:00 2001 From: Wackyator Date: Fri, 18 Oct 2024 15:11:25 +0530 Subject: [PATCH 2/3] doc: Add instruction for running tunnel --- references/README.md | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/references/README.md b/references/README.md index c261f65e71..8d73990548 100644 --- a/references/README.md +++ b/references/README.md @@ -52,13 +52,31 @@ This guide assumes that you have followed the [Contributing.md](https://github.c #### Step-by-Step Instructions -1. **Run the webapp on localhost**: +1. **Run a http tunnel**: +You will need to run a 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. +- Download the ngrok CLI. This can be done by following the instructions on ngrok's [website](https://ngrok.com/docs/getting-started/). +- Create an account on ngrok to obtain the authtoken and add it to the CLI. +``` +ngrok config add-authtoken +``` +Replace the with the token you obtain from ngrok. +- Run the tunnel. +``` +ngrok http +``` +Replace the with the webapp port, default is `3030`. + +2. **Add your tunnel URL to the env**: +After running the ngrok tunnel, you will see URL in your terminal, it will look something like `https://.ngrok-free.app`. +Replace the `APP_ORIGIN` variable with this URL in your `.env` file in the root of the trigger.dev project. + +3. **Run the webapp on localhost**: ``` pnpm run dev --filter webapp --filter coordinator --filter docker-provider ``` -2. **Build the CLI in a new terminal window**: +4. **Build the CLI in a new terminal window**: ``` # Build the CLI @@ -68,12 +86,12 @@ pnpm run build --filter trigger.dev pnpm i ``` -3. **Set up a new project in the webapp**: +5. **Set up a new project in the webapp**: - Open the webapp running on `localhost:3030`. - Create a new project in the webapp UI. - Go to the *Project Settings* page and copy the project reference id from there. -4. **Copy the hello-world project as a template**: +6. **Copy the hello-world project as a template**: ``` cp -r references/hello-world references/ @@ -81,21 +99,29 @@ cp -r references/hello-world references/ Replace `` with your desired project name. -5. **Update project details**: +7. **Update project details**: - Open `/package.json` and change the name field. *(Tip: Use the same name as in the webapp to avoid confusion.)* - Open `/trigger.config.ts` and update the project field with the project reference you copied from the webapp. -6. **Authorize the CLI for your project**: +- Run `pnpm i` in your `` directory to sync the dependencies. + +8. **Authorize the CLI for your project**: ``` pnpm exec trigger login -a http://localhost:3030 --profile local ``` -7. **Run the new project**: +9. **Run the new project**: You can now run your project using the CLI with the following command: ``` pnpm exec trigger dev --profile local ``` + +You can also deploy them against your local instance with the following command: + +``` +pnpm exec trigger deploy --self-hosted --load-image --profile local +``` From f9494f293b4f3a1e62efc4d1591b1d4348e622fb Mon Sep 17 00:00:00 2001 From: Wackyator Date: Fri, 18 Oct 2024 16:37:27 +0530 Subject: [PATCH 3/3] minor language improvement --- references/README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/references/README.md b/references/README.md index 8d73990548..5dba21962a 100644 --- a/references/README.md +++ b/references/README.md @@ -52,16 +52,18 @@ This guide assumes that you have followed the [Contributing.md](https://github.c #### Step-by-Step Instructions -1. **Run a http tunnel**: -You will need to run a 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. +1. **Run an HTTP tunnel**: +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. - Download the ngrok CLI. This can be done by following the instructions on ngrok's [website](https://ngrok.com/docs/getting-started/). - Create an account on ngrok to obtain the authtoken and add it to the CLI. -``` + +```bash ngrok config add-authtoken ``` Replace the with the token you obtain from ngrok. - Run the tunnel. -``` + +```bash ngrok http ``` Replace the with the webapp port, default is `3030`. @@ -72,13 +74,13 @@ Replace the `APP_ORIGIN` variable with this URL in your `.env` file in the root 3. **Run the webapp on localhost**: -``` +```bash pnpm run dev --filter webapp --filter coordinator --filter docker-provider ``` 4. **Build the CLI in a new terminal window**: -``` +```bash # Build the CLI pnpm run build --filter trigger.dev @@ -93,7 +95,7 @@ pnpm i 6. **Copy the hello-world project as a template**: -``` +```bash cp -r references/hello-world references/ ``` @@ -109,19 +111,19 @@ Replace `` with your desired project name. 8. **Authorize the CLI for your project**: -``` +```bash pnpm exec trigger login -a http://localhost:3030 --profile local ``` 9. **Run the new project**: You can now run your project using the CLI with the following command: -``` +```bash pnpm exec trigger dev --profile local ``` You can also deploy them against your local instance with the following command: -``` +```bash pnpm exec trigger deploy --self-hosted --load-image --profile local ```