|
1 | 1 | # ADaaS Template
|
2 | 2 |
|
3 |
| -This GitHub repository provides a template with example code to implement an Airdrop as a Service (ADaaS) Snap-in. |
| 3 | +This GitHub repository provides a template with example code to implement an Airdrop as a Service (ADaaS) snap-in. |
4 | 4 |
|
5 | 5 | ## Prerequisites
|
6 | 6 |
|
7 |
| -1\. Install [DevRev CLI](https://developer.devrev.ai/snapin-development/references/cli-install) by following the instructions as per the Operating System. |
8 |
| - |
9 |
| -2\. Install [jq](https://jqlang.github.io/jq/download/). |
10 |
| - |
11 |
| -3\. Install [Node.js](https://nodejs.org/en/download/). |
12 |
| - |
13 |
| -4\. Install [ngrok](https://ngrok.com/download). |
| 7 | +1. Install [DevRev CLI](https://developer.devrev.ai/snapin-development/references/cli-install) by following the instructions as per the Operating System. |
| 8 | +2. Install [jq](https://jqlang.github.io/jq/download/). |
| 9 | +3. Install [Node.js](https://nodejs.org/en/download/). |
| 10 | +4. Install [ngrok](https://ngrok.com/download). |
14 | 11 |
|
15 | 12 | ## Getting Started
|
16 | 13 |
|
17 |
| -1\. Create a new repository: |
18 |
| - |
19 |
| -- Create a new repository from this template by clicking the "Use this template" button in the upper right corner and then "Create a new repository". |
20 |
| -- The repository name must start with `airdrop-` (e.g., `airdrop-<external system>-snap-in`). |
21 |
| - |
22 |
| -2\. Open the project in your IDE and authenticate to your DevRev organization using the DevRev CLI: |
23 |
| - |
24 |
| -```bash |
25 |
| -devrev profiles authenticate --org <your DevRev Organization slug> |
26 |
| -``` |
27 |
| - |
28 |
| -3\. Install the Snap-in dependencies from the `code` directory: |
29 |
| - |
30 |
| -```bash |
31 |
| -npm ci |
32 |
| -``` |
33 |
| - |
34 |
| -4\. Start the Snap-in development server from the `code` directory: |
35 |
| - |
36 |
| -```bash |
37 |
| -npm run test:server -- local |
38 |
| -``` |
39 |
| - |
40 |
| -This will start the Snap-in server on `http://localhost:8000`. |
41 |
| - |
42 |
| -5\. Start the ngrok tunnel in a separate terminal window: |
43 |
| - |
44 |
| -```bash |
45 |
| -ngrok http 8000 |
46 |
| -``` |
47 |
| - |
48 |
| -This will create a tunnel to your local server. The ngrok forwarding URL will be displayed in the terminal window. |
49 |
| - |
50 |
| -6\. Copy the ngrok forwarding URL and create a new Snap-in version and Snap-in package using the DevRev CLI: |
51 |
| - |
52 |
| -```bash |
53 |
| -devrev snap_in_version create-one --manifest ./manifest.yaml --create-package --testing-url <ngrok forwarding URL> |
54 |
| -``` |
55 |
| - |
56 |
| -7\. Create a Snap-in draft using the DevRev CLI: |
57 |
| - |
58 |
| -```bash |
59 |
| -devrev snap_in draft |
60 |
| -``` |
61 |
| - |
62 |
| -8\. After the Snap-in draft is created, install the Snap-in in the DevRev UI (`Settings` -> `Snap-ins` -> `Installed` -> `<your Snap-in>` -> `Install snap-in`) or using the DevRev CLI: |
63 |
| - |
64 |
| -```bash |
65 |
| -devrev snap_in activate |
66 |
| -``` |
67 |
| - |
68 |
| -9\. Start the import (`Airdrops` -> `Start Airdrop` -> `<your Snap-in>`). |
| 14 | +1. Create a new repository: |
| 15 | + - Create a new repository from this template by clicking the "Use this template" button in the upper right corner and then "Create a new repository". |
| 16 | + - The repository name must start with `airdrop-` (e.g., `airdrop-<external system>-snap-in`). |
| 17 | +2. Open the project in your IDE and authenticate to your DevRev organization using the DevRev CLI: |
| 18 | + ```bash |
| 19 | + devrev profiles authenticate --org <your DevRev Organization slug> |
| 20 | + ``` |
| 21 | +3. Install the Snap-in dependencies from the `code` directory: |
| 22 | + ```bash |
| 23 | + npm ci |
| 24 | + ``` |
| 25 | +4. Start the Snap-in development server from the `code` directory: |
| 26 | + ```bash |
| 27 | + npm run test:server -- local |
| 28 | + ``` |
| 29 | + This will start the Snap-in server on `http://localhost:8000`. |
| 30 | +5. Start the ngrok tunnel in a separate terminal window: |
| 31 | + ```bash |
| 32 | + ngrok http 8000 |
| 33 | + ``` |
| 34 | + This will create a tunnel to your local server. |
| 35 | + The ngrok forwarding URL will be displayed in the terminal window. |
| 36 | +6. Copy the ngrok forwarding URL and create a new Snap-in version and Snap-in package using the DevRev CLI: |
| 37 | + ```bash |
| 38 | + devrev snap_in_version create-one --manifest ./manifest.yaml --create-package --testing-url <ngrok forwarding URL> |
| 39 | + ``` |
| 40 | +7. Create a Snap-in draft using the DevRev CLI: |
| 41 | + ```bash |
| 42 | + devrev snap_in draft |
| 43 | + ``` |
| 44 | +8. After the Snap-in draft is created, install the Snap-in in the DevRev UI (`Settings` -> `Snap-ins` -> `Installed` -> `<your Snap-in>` -> `Install snap-in`) or using the DevRev CLI: |
| 45 | + ```bash |
| 46 | + devrev snap_in activate |
| 47 | + ``` |
| 48 | +9. Start the import (`Airdrops` -> `Start Airdrop` -> `<your Snap-in>`). |
69 | 49 |
|
70 | 50 | ## Build, Deploy and Run
|
71 | 51 |
|
72 |
| -1\. Open the project in your IDE and set up project environment variables, by following these steps: |
73 |
| - |
74 |
| -- Rename `.env.example` to `.env`. |
75 |
| -- In `.env` set the slug of your organization, and your email. |
76 |
| - |
77 |
| -2\. Build the Snap-in using the following command: |
78 |
| - |
79 |
| -```bash |
80 |
| -make build |
81 |
| -``` |
82 |
| - |
83 |
| -3\. Deploy the Snap-in to the organization: |
84 |
| - |
85 |
| -```bash |
86 |
| -make deploy |
87 |
| -``` |
88 |
| - |
89 |
| -NOTE: This process may take some time. Command authenticates you to the org using the DevRev CLI, creates a Snap-in package, its Snap-in version, and finally the Snap-in draft. |
90 |
| - |
91 |
| -4\. After the Snap-in draft is created, install the Snap-in in the DevRev UI (`Settings` -> `Snap-ins` -> `Installed` -> `<your Snap-in>` -> `Install snap-in`) or using the DevRev CLI: |
92 |
| - |
93 |
| -```bash |
94 |
| -devrev snap_in activate |
95 |
| -``` |
96 |
| - |
97 |
| -5\. Start the import (`Airdrops` -> `Start Airdrop` -> `<your Snap-in>`). |
| 52 | +1. Open the project in your IDE and set up project environment variables, by following these steps: |
| 53 | + - Rename `.env.example` to `.env`. |
| 54 | + - In `.env` set the slug of your organization, and your email. |
| 55 | +2. Build the Snap-in using the following command: |
| 56 | + ```bash |
| 57 | + make build |
| 58 | + ``` |
| 59 | +3. Deploy the Snap-in to the organization: |
| 60 | + ```bash |
| 61 | + make deploy |
| 62 | + ``` |
| 63 | + NOTE: This process may take some time. |
| 64 | + The command authenticates you to the org using the DevRev CLI, |
| 65 | + creates a snap-in package, its snap-in version, and finally the snap-in draft. |
| 66 | +4. After the Snap-in draft is created, install the Snap-in in the DevRev UI (`Settings` -> `Snap-ins` -> `Installed` -> `<your Snap-in>` -> `Install snap-in`) or using the DevRev CLI: |
| 67 | + ```bash |
| 68 | + devrev snap_in activate |
| 69 | + ``` |
| 70 | +5. Start the import (`Airdrops` -> `Start Airdrop` -> `<your Snap-in>`). |
98 | 71 |
|
99 | 72 | ## Common Pitfalls
|
100 | 73 |
|
101 | 74 | - `Conflict` error after the `Creating snap-in package...` output during `make deploy`.
|
102 |
| - |
103 | 75 | - Snap-in package with the same slug already exists. Override the `SNAP_IN_SLUG` variable by explicitly updating the variable in `scripts/vars.sh`.
|
104 |
| - |
105 | 76 | - Snap-in version `build/deployment failed` after the `Waiting for snap-in version to be ready...` message
|
106 |
| - |
107 | 77 | - The snap-in version could not be built. Check the logs by running the DevRev CLI command `devrev snap_in_package logs`. For prettier UI, pipe the output to `jq`
|
108 |
| - |
109 | 78 | - `Token is expired` when deploying or cleaning up.
|
110 |
| - |
111 | 79 | - Authentication token to the `DEV_ORG` has expired. Run `make auth` to reconnect to the organization.
|
0 commit comments