-
Notifications
You must be signed in to change notification settings - Fork 189
feat: Add fly.io deployment #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ab879df
update docker file
leehuwuj fc9495b
update readme
leehuwuj c304cda
update docs
leehuwuj addc029
Merge branch 'main' into feat/add-deployment
marcusschiesser 5bdd1ff
docs: wordsmith
marcusschiesser e5a7e0f
docs: add vectorDB
marcusschiesser ec870bb
remove internal port
leehuwuj f7433f4
update ha doc
leehuwuj c58338f
add missing change
leehuwuj fd499ba
fix: command
marcusschiesser d9f939d
docs: changeset
marcusschiesser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-llama": patch | ||
--- | ||
|
||
Add fly.io deployment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
## Deployments | ||
marcusschiesser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Using [Fly.io](https://fly.io/): | ||
|
||
First, install [flyctl](https://fly.io/docs/flyctl/install/) and then authenticate with your Fly.io account: | ||
|
||
```shell | ||
fly auth login | ||
``` | ||
|
||
Then, run this command and follow the prompts to deploy the app.: | ||
|
||
```shell | ||
fly launch | ||
``` | ||
|
||
And to open the app in your browser: | ||
|
||
```shell | ||
fly apps open | ||
``` | ||
|
||
> **Note**: The app will use the values from the `.env` file by default to simplify the deployment. Make sure all the needed environment variables in the [.env](.env) file are set. For production environments, you should not use the `.env` file, but [set the variables in Fly.io](https://fly.io/docs/rails/the-basics/configuration/) instead. | ||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Documents | ||
|
||
If you're having documents in the `./data` folder, run the following command to generate vector embeddings of the documents: | ||
|
||
``` | ||
fly console --machine <machine_id> --command "poetry run generate" | ||
``` | ||
|
||
Where `machine_id` is the ID of the machine where the app is running. You can show the running machines with the `fly machines` command. | ||
|
||
> **Note**: Using documents will make the app stateful. As Fly.io is a stateless app, you should use [LlamaCloud](https://docs.cloud.llamaindex.ai/llamacloud/getting_started) or a vector database to store the embeddings of the documents. This applies also for document uploads by the user. | ||
|
||
### Using Docker | ||
|
||
First, build an image for the app: | ||
|
||
``` | ||
docker build -t <your_image_name> . | ||
``` | ||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Then, start the app by running the image: | ||
|
||
``` | ||
docker run \ | ||
-v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system | ||
-v $(pwd)/config:/app/config \ | ||
-v $(pwd)/storage:/app/storage \ # Use your file system to store vector embeddings | ||
-p 8000:8000 \ | ||
<your_image_name> | ||
``` | ||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Open [http://localhost:8000](http://localhost:8000) with your browser to start the app. | ||
|
||
#### Documents | ||
|
||
If you're having documents in the `./data` folder, run the following command to generate vector embeddings of the documents: | ||
|
||
``` | ||
docker run \ | ||
--rm \ | ||
-v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system | ||
-v $(pwd)/config:/app/config \ | ||
-v $(pwd)/data:/app/data \ # Use your local folder to read the data | ||
-v $(pwd)/storage:/app/storage \ # Use your file system to store the vector database | ||
<your_image_name> \ | ||
poetry run generate | ||
``` | ||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The app will then be able to answer questions about the documents in the `./data` folder. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:20-alpine as build | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies | ||
COPY package.json package-lock.* ./ | ||
RUN npm install | ||
|
||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Build the application | ||
COPY . . | ||
RUN npm run build | ||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# ==================================== | ||
FROM build as release | ||
|
||
CMD ["npm", "run", "start"] | ||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.