fly_io.mdx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---
  2. title: 'Fly.io'
  3. description: 'Deploy your RAG application to fly.io platform'
  4. ---
  5. Embedchain has a nice and simple abstraction on top of the [Fly.io](https://fly.io/) tools to let developers deploy RAG application to fly.io platform seamlessly.
  6. Follow the instructions given below to deploy your first application quickly:
  7. ## Step-1: Install flyctl command line
  8. <CodeGroup>
  9. ```bash OSX
  10. brew install flyctl
  11. ```
  12. ```bash Linux
  13. curl -L https://fly.io/install.sh | sh
  14. ```
  15. ```bash Windows
  16. pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"
  17. ```
  18. </CodeGroup>
  19. Once you have installed the fly.io cli tool, signup/login to their platform using the following command:
  20. <CodeGroup>
  21. ```bash Sign up
  22. fly auth signup
  23. ```
  24. ```bash Sign in
  25. fly auth login
  26. ```
  27. </CodeGroup>
  28. In case you run into issues, refer to official [fly.io docs](https://fly.io/docs/hands-on/install-flyctl/).
  29. ## Step-2: Create RAG app
  30. We provide a command line utility called `ec` that inherits the template for `fly.io` platform and help you deploy the app. Follow the instructions to create a fly.io app using the template provided:
  31. ```bash Create application
  32. mkdir my-rag-app
  33. ec create --template=fly.io
  34. ```
  35. This will generate a directory structure like this:
  36. ```bash
  37. ├── Dockerfile
  38. ├── app.py
  39. ├── fly.toml
  40. ├── .env
  41. ├── .env.example
  42. └── requirements.txt
  43. ```
  44. Feel free to edit the files as required.
  45. - `Dockerfile`: Defines the steps to setup the application
  46. - `app.py`: Contains FastAPI app code
  47. - `fly.toml`: fly.io config file
  48. - `.env`: Contains environment variables for production
  49. - `.env.example`: Contains dummy environment variables (can ignore this file)
  50. - `requirements.txt`: Contains python dependencies for your FastAPI application
  51. ## Step-3: Test app locally
  52. You can run the app locally by simply doing:
  53. ```bash Run locally
  54. pip install -r requirements.txt
  55. ec dev
  56. ```
  57. ## Step-4: Deploy to fly.io
  58. You can deploy to fly.io using the following command:
  59. ```bash Deploy app
  60. ec deploy
  61. ```
  62. Once this step finished, it will provide you with the deployment endpoint where you can access the app live. It will look something like this:
  63. You can also check the logs, monitor app status etc on their dashboard by running command `fly dashboard`.
  64. <img src="/images/fly_io.png" />
  65. ## Seeking help?
  66. If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
  67. <Snippet file="get-help.mdx" />