fly_io.mdx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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` in embedchain 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 Install embedchain
  32. pip install embedchain
  33. ```
  34. ```bash Create application
  35. mkdir my-rag-app
  36. ec create --template=fly.io
  37. ```
  38. This will generate a directory structure like this:
  39. ```bash
  40. ├── Dockerfile
  41. ├── app.py
  42. ├── fly.toml
  43. ├── .env
  44. ├── .env.example
  45. ├── embedchain.json
  46. └── requirements.txt
  47. ```
  48. Feel free to edit the files as required.
  49. - `Dockerfile`: Defines the steps to setup the application
  50. - `app.py`: Contains API app code
  51. - `fly.toml`: fly.io config file
  52. - `.env`: Contains environment variables for production
  53. - `.env.example`: Contains dummy environment variables (can ignore this file)
  54. - `embedchain.json`: Contains embedchain specific configuration for deployment (you don't need to configure this)
  55. - `requirements.txt`: Contains python dependencies for your application
  56. ## Step-3: Test app locally
  57. You can run the app locally by simply doing:
  58. ```bash Run locally
  59. pip install -r requirements.txt
  60. ec dev
  61. ```
  62. ## Step-4: Deploy to fly.io
  63. You can deploy to fly.io using the following command:
  64. ```bash Deploy app
  65. ec deploy
  66. ```
  67. 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 (Swagger docs):
  68. You can also check the logs, monitor app status etc on their dashboard by running command `fly dashboard`.
  69. <img src="/images/fly_io.png" />
  70. ## Seeking help?
  71. If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
  72. <Snippet file="get-help.mdx" />