Skip to content

Commit e1a7d8d

Browse files
authored
docs : Update installation-deployments.md
Added steps of deployment for - Vercel - Fastly - AWS Lambda - Lambda@edge - Supabase Functions
1 parent 3c75441 commit e1a7d8d

File tree

1 file changed

+154
-41
lines changed

1 file changed

+154
-41
lines changed

docs/installation-deployments.md

Lines changed: 154 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@ Check out the [API docs](https://portkey.ai/docs/welcome/make-your-first-request
1515
## Local Deployment
1616

1717
1. Do [NPM](#node) or [Bun](#bun) Install
18-
2. Run a [Node.js Server](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#run-a-nodejs-server)
18+
2. Run a [Node.js Server](#nodejs-server)
1919
3. Deploy on [App Stack](#deploy-to-app-stack)
20-
4. Deploy on [Cloudflare Workers](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#deploy-to-cloudflare-workers)
21-
5. Deploy using [Docker](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#deploy-using-docker)
22-
6. Deploy using [Docker Compose](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#deploy-using-docker-compose)
20+
4. Deploy on [Cloudflare Workers](#cloudflare-workers)
21+
5. Deploy using [Docker](#docker)
22+
6. Deploy using [Docker Compose](#docker-compose)
2323
7. Deploy on [Replit](#replit)
24-
8. Deploy on [Zeabur](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#deploy-to-zeabur)
24+
8. Deploy on [Zeabur](#zeabur)
25+
9. Deploy on [Vercel](#vercel)
26+
10. Deploy using [Fastly](#fastly)
27+
11. Deploy on [AWS Lambda](#aws-lambda)
28+
12. Deploy on [Lambda@edge](#lambda-edge)
29+
13. Deploy with [Supabase Functions](#supabase-functions)
30+
31+
---
2532

2633
### Node
2734

@@ -39,7 +46,35 @@ $ bunx @portkey-ai/gateway
3946

4047
<br>
4148

42-
# Deploy to App Stack
49+
---
50+
51+
### NodeJS Server
52+
53+
1. Clone the Repository
54+
55+
```sh
56+
git clone https://github.com/portkey-ai/gateway
57+
```
58+
59+
2. Install the NPM Dependencies
60+
61+
```sh
62+
cd gateway
63+
npm i
64+
npm run build
65+
```
66+
67+
3. Run the Server
68+
69+
```sh
70+
node build/start-server.js
71+
```
72+
73+
<br>
74+
75+
---
76+
77+
### Deploy to App Stack
4378
F5 Distributed Cloud
4479
1. [Create an App Stack Site](https://docs.cloud.f5.com/docs/how-to/site-management/create-voltstack-site)
4580

@@ -94,7 +129,8 @@ curl --request POST \
94129
--data '{"metadata": {"name": "$DISTRIBUTED_CLOUD_SERVICE_NAME","namespace": "$DISTRIBUTED_CLOUD_NAMESPACE","labels": {},"annotations": {},"description": "","disable": false},"spec": {"origin_servers": [{"k8s_service": {"service_name": "$DISTRIBUTED_CLOUD_SERVICE_NAME.$DISTRIBUTED_CLOUD_APP_STACK_NAMESPACE","site_locator": {"site": {"tenant": "$DISTRIBUTED_CLOUD_TENANT_ID","namespace": "system","name": "$DISTRIBUTED_CLOUD_APP_STACK_SITE"}},"inside_network": {}},"labels": {}}],"no_tls": {},"port": 8787,"same_as_endpoint_port": {},"healthcheck": [],"loadbalancer_algorithm": "LB_OVERRIDE","endpoint_selection": "LOCAL_PREFERRED","advanced_options": null}}'
95130
```
96131
or [use the UI](https://docs.cloud.f5.com/docs/how-to/app-networking/origin-pools)
97-
5. Create an HTTP Load Balancer, including header injection of Portkey provider and credentials
132+
133+
6. Create an HTTP Load Balancer, including header injection of Portkey provider and credentials
98134
```shell
99135
curl --request POST \
100136
--url https://$DISTRIBUTED_CLOUD_TENANT.console.ves.volterra.io/api/config/namespaces/$DISTRIBUTED_CLOUD_NAMESPACE/http_loadbalancers \
@@ -103,7 +139,8 @@ curl --request POST \
103139
--data '{"metadata": {"name": "$DISTRIBUTED_CLOUD_SERVICE_NAME","namespace": "$DISTRIBUTED_CLOUD_NAMESPACE","labels": {},"annotations": {},"description": "","disable": false},"spec": {"domains": ["$PORTKEY_GATEWAY_FQDN"],"https_auto_cert": {"http_redirect": true,"add_hsts": false,"tls_config": {"default_security": {}},"no_mtls": {},"default_header": {},"enable_path_normalize": {},"port": 443,"non_default_loadbalancer": {},"header_transformation_type": {"default_header_transformation": {}},"connection_idle_timeout": 120000,"http_protocol_options": {"http_protocol_enable_v1_v2": {}}},"advertise_on_public_default_vip": {},"default_route_pools": [{"pool": {"tenant": "$DISTRIBUTED_CLOUD_TENANT_ID","namespace": "$DISTRIBUTED_CLOUD_NAMESPACE","name": "$DISTRIBUTED_CLOUD_SERVICE_NAME"},"weight": 1,"priority": 1,"endpoint_subsets": {}}],"origin_server_subset_rule_list": null,"routes": [],"cors_policy": null,"disable_waf": {},"add_location": true,"no_challenge": {},"more_option": {"request_headers_to_add": [{"name": "x-portkey-provider","value": "$PORTKEY_PROVIDER","append": false},{"name": "Authorization","value": "Bearer $PORTKEY_PROVIDER_AUTH_TOKEN","append": false}],"request_headers_to_remove": [],"response_headers_to_add": [],"response_headers_to_remove": [],"max_request_header_size": 60,"buffer_policy": null,"compression_params": null,"custom_errors": {},"javascript_info": null,"jwt": [],"idle_timeout": 30000,"disable_default_error_pages": false,"cookies_to_modify": []},"user_id_client_ip": {},"disable_rate_limit": {},"malicious_user_mitigation": null,"waf_exclusion_rules": [],"data_guard_rules": [],"blocked_clients": [],"trusted_clients": [],"api_protection_rules": null,"ddos_mitigation_rules": [],"service_policies_from_namespace": {},"round_robin": {},"disable_trust_client_ip_headers": {},"disable_ddos_detection": {},"disable_malicious_user_detection": {},"disable_api_discovery": {},"disable_bot_defense": {},"disable_api_definition": {},"disable_ip_reputation": {},"disable_client_side_defense": {},"csrf_policy": null,"graphql_rules": [],"protected_cookies": [],"host_name": "","dns_info": [],"internet_vip_info": [],"system_default_timeouts": {},"jwt_validation": null,"disable_threat_intelligence": {},"l7_ddos_action_default": {},}}'
104140
```
105141
or [use the UI](https://docs.cloud.f5.com/docs/how-to/app-networking/http-load-balancer)
106-
6. Test the service
142+
143+
7. Test the service
107144
```shell
108145
curl --request POST \
109146
--url https://$PORTKEY_GATEWAY_FQDN/v1/chat/completions \
@@ -137,6 +174,7 @@ in addition to the response headers, you should get a response body like
137174
}
138175
```
139176

177+
---
140178

141179
### Cloudflare Workers
142180

@@ -159,33 +197,10 @@ npm install
159197
npm run deploy
160198
```
161199

200+
For more details, refer to [Cloudflare Workers official](https://developers.cloudflare.com/workers/).
162201
<br>
163202

164-
### NodeJS Server
165-
166-
1. Clone the Repository
167-
168-
```sh
169-
git clone https://github.com/portkey-ai/gateway
170-
```
171-
172-
2. Install the NPM Dependencies
173-
174-
```sh
175-
cd gateway
176-
npm i
177-
npm run build
178-
```
179-
180-
<br>
181-
182-
3. Run the Server
183-
184-
```sh
185-
node build/start-server.js
186-
```
187-
188-
<br>
203+
---
189204

190205
### Docker
191206

@@ -199,6 +214,8 @@ For more information on the Docker image, check [here](https://hub.docker.com/r/
199214

200215
<br>
201216

217+
---
218+
202219
### Docker Compose
203220

204221
1. Download Compose File from the Repository:
@@ -214,50 +231,146 @@ docker compose up -d
214231
```
215232
> The service is now running and listening on port 8787
216233
234+
For more details, refer to [Docker Compose official](https://docs.docker.com/compose/).
217235
<br>
218236

237+
---
238+
219239
### Replit
220240

221241
[![Deploy on Replit](https://replit.com/badge?caption=Deploy%20on%20Replit)](https://replit.com/@portkey/AI-Gateway?v=1)
222242

223-
<br>
243+
---
224244

225245
### Zeabur
226246

227247
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/RU38E3)
228248

229-
<br>
249+
---
230250

231251
### Vercel
232252

233-
Docs to be written, please help!
253+
1. Clone the Repository
254+
255+
```sh
256+
git clone https://github.com/portkey-ai/gateway
257+
```
258+
259+
2. Set up a new project in Vercel by linking the repository.
260+
261+
3. Configure environment variables in Vercel's dashboard, matching those in the `deployment.yaml` file (e.g., `PORTKEY_PROVIDER`, `PORTKEY_PROVIDER_AUTH_TOKEN`).
262+
263+
4. Adjust the project to use Vercel’s serverless function framework if needed.
264+
265+
5. Deploy your application.
266+
267+
For more details, refer to [Vercel's documentation](https://vercel.com/docs/deployments/git/vercel-for-github).
234268

235269
<br>
236270

271+
---
272+
237273
### Fastly
238274

239-
Docs to be written, please help!
275+
1. Follow Fastly’s [Compute@Edge tutorial](https://www.fastly.com/documentation/guides/compute/).
276+
277+
2. Clone the Gateway Repository:
278+
279+
```sh
280+
git clone https://github.com/portkey-ai/gateway
281+
```
282+
283+
3. Install Fastly’s CLI:
284+
285+
```sh
286+
npm install -g @fastly/cli
287+
```
288+
289+
4. Create a new Fastly service and link it to your cloned Gateway repo.
290+
291+
5. Modify the `gateway` code to fit into Fastly's Compute@Edge runtime, considering its unique environment for handling edge requests.
292+
293+
6. Deploy the service using Fastly CLI:
294+
295+
```sh
296+
fastly compute publish
297+
```
298+
299+
For more details, refer to [Fastly’s official](https://www.fastly.com/).
240300

241301
<br>
242302

303+
---
304+
243305
### AWS Lambda
244306

245-
Docs to be written, please help!
307+
1. Clone the Repository:
308+
```sh
309+
git clone https://github.com/portkey-ai/gateway
310+
```
311+
312+
2. Create a new AWS Lambda function via the AWS Management Console.
313+
314+
3. Use AWS Lambda Layers to include the necessary Node.js/Bun dependencies (e.g., `npm`).
315+
316+
4. Zip the Gateway project (excluding `node_modules`) and upload it to your Lambda function.
317+
318+
5. Configure environment variables for your Lambda function.
319+
320+
6. Set up an API Gateway for HTTP requests and route them to your Lambda function.
321+
322+
For more detailed steps, refer to the AWS Lambda [deployment documentation](https://docs.aws.amazon.com/lambda/).
246323

247324
<br>
248325

249-
### Lambda@edge
326+
---
327+
328+
### Lambda edge
329+
330+
1. Clone the Repository:
331+
332+
```sh
333+
git clone https://github.com/portkey-ai/gateway
334+
```
335+
336+
2. Prepare the project for Lambda@Edge deployment by ensuring that request handling works within CloudFront constraints.
337+
338+
3. Set up an AWS CloudFront distribution.
250339

251-
Docs to be written, please help!
340+
4. Deploy the Lambda function to the edge using the `aws` CLI or AWS Console.
341+
342+
5. Attach the Lambda@Edge function to the CloudFront distribution.
343+
344+
More information is available in AWS’s official [Lambda@Edge documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-at-the-edge.html).
252345

253346
<br>
254347

348+
---
349+
255350
### Supabase Functions
256351

257-
Docs to be written, please help!
352+
1. Clone the Repository:
353+
354+
```sh
355+
git clone https://github.com/portkey-ai/gateway
356+
```
357+
358+
2. Set up a Supabase project and create a new function.
359+
360+
3. Modify the project to use Supabase’s environment.
361+
362+
4. Deploy using the Supabase CLI:
363+
364+
```sh
365+
supabase functions deploy your-function-name
366+
```
367+
368+
Refer to [Supabase's official documentation](https://supabase.com/docs) for more details.
258369

259370
<br>
260371

372+
---
373+
261374
## Enterprise Deployment
262375
Make your AI app more <ins>reliable</ins> and <ins>forward compatible</ins>, while ensuring complete <ins>data security</ins> and <ins>privacy</ins>.
263376

0 commit comments

Comments
 (0)