The backend infrastructure-as-code (IAC) and lambda code for the SymphonAI APIs.
The cdk.json file tells the CDK toolkit how to execute your app.
- Clone this git repo to your machine
- Install Golang (https://go.dev/doc/install)
- In your command-line interface (CLI), run the following in the root directory of this repository:
go get - Install VS Code (https://code.visualstudio.com/)
- Install the Go plugin and associated tools for VS Code (https://medium.com/backend-habit/setting-golang-plugin-on-vscode-for-autocomplete-and-auto-import-30bf5c58138a). Ignore steps 2, 3 and 4 in this guide if you're on a Mac
- Install the AWS CDK toolkit: https://docs.aws.amazon.com/cdk/v2/guide/cli.html
- Setup a AWS profile for deployment from your machine if you haven't already: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
You can try running the API locally using the SAM CLI, but no guarantees all the code (like Cognito access etc.) will run properly.
-
Carry out all the steps in the Developer Setup section above.
-
Install Docker (https://www.docker.com/)
-
Install the SAM CLI (https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)
-
Create a
env.jsonfile in this root directory, with this format:{ "Parameters": { "OPENAI_MODEL": "<<model>>", "OPENAI_API_KEY": "<<apikey>>", "SPOTIFY_CLIENT_ID": "<<spotifyclientid>", "SPOTIFY_CLIENT_SECRET": "<<spotifyclientsecret>>" } }Replace
<<model>>with one of the following, depending on which model you want to use:- davinci
- gpt-3.5-turbo
- gpt-4
Replace
<<apikey>>with the ChatGPT API Key you want to use.env.jsonis in the .gitignore, but just in case: Please do not check in this file to version control!Replace
<<spotifyclientid>>and<<spotifyclientsecret>>with the Spotify Developer App Client ID and App Client Secret.
First follow the steps above (Setup Steps for Running Locally), then do the following:
-
Make sure Docker is running.
-
In the CLI, navigate to this directory and run:
make start. This will expose the API on http://localhost:8080, so you will be able to hit API endpoints like http://localhost:8080/prompt.
Note: If the make command doesn't work on your machine, then you will need to install Make. The exact instructions vary depending on your OS, so you might have to Google....here are instructions for Ubuntu: https://linuxhint.com/install-make-ubuntu/
If you are unable to install make, then run the individual commands under make start that are listed in the Makefile contained within the root directory.
- Press Ctrl+C to stop running the API on your machine.
Run cdk deploy to run the infrastructure/code changes against AWS.
TODO: Automate deployment via Github actions
cdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation templatego testrun unit tests