Skip to content

Commit

Permalink
docs: running local dev server for website
Browse files Browse the repository at this point in the history
  • Loading branch information
skierkowski committed Sep 10, 2024
1 parent a2861c3 commit 503ef9c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,25 @@ with the service name.
serverless auth deploy
```

The `website` service is a static website that is served from an AWS Lambda
function. As such, it can run locally without needing to use Dev Mode. However,
it has a dependency on the AI Chat service and the Auth service, so you must
configure environment variables locally.

```
# If you have the jq CLI command installed you can use that with the --json flag
# on serverless info to get the URLs from the deployed services. If you do not
# have jq installed, you can get the URLs by running "serverless auth info" and
# "serverless ai-chat info" and copying the URLs manually into the environment
# variables.
export VITE_CHAT_API_URL=$(serverless aiChatApi info --json | jq -r '.outputs[] | select(.OutputKey == "ChatApiUrl") | .OutputValue')
export VITE_AUTH_API_URL=$(serverless auth info --json | jq -r '.outputs[] | select(.OutputKey == "AuthApiUrl") | .OutputValue')
# now you can run the local development server
cd website/app
npm run build
```

## 4. Prepare & release to prod

Now that the app is up and running in a development environment, lets get it
Expand Down Expand Up @@ -155,8 +174,10 @@ https://us-east-1.console.aws.amazon.com/acm/home?region=us-east-1#/certificates
This example uses a Certificate with the following full qualified domain names:

```
awsaistack.com
*.awsaistack.com
\*.awsaistack.com
```

The base domain name, `awsaistack.com` is used for the website service
Expand Down Expand Up @@ -189,7 +210,9 @@ with a key like `/awsaistack/shared-token`, and set it in the
`sharedTokenSecret` parameter in the `serverless-compose.yml` file:

```
sharedTokenSecret: ${ssm:/awsaistack/shared-token}
```

### Deploy to prod
Expand All @@ -198,7 +221,9 @@ Once you've setup the custom domain name (optional), and created the secret, you
are ready to deploy the service to prod.

```
serverless deploy --stage prod
```

Now you can use the service by visiting your domain name, or
Expand Down
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion website/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "module",
"scripts": {
"dev": "vite",
"watch": "vite build --watch --outDir ../.serverless/build/app/build",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
Expand Down

0 comments on commit 503ef9c

Please sign in to comment.