Skip to content

Commit

Permalink
Add app deployment guides for Fly.io, Render, and Railway (#6983)
Browse files Browse the repository at this point in the history
  • Loading branch information
beerose authored Mar 6, 2024
1 parent 40317e2 commit 90cdbf8
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 7 deletions.
56 changes: 56 additions & 0 deletions docs/guides/cloud/deploy/fly.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. _ref_guide_cloud_deploy_fly:

======
Fly.io
======

:edb-alt-title: Deploying applications built on EdgeDB Cloud to Fly.io

1. Install the `Fly.io CLI <https://fly.io/docs/hands-on/install-flyctl/>`_
2. Log in to Fly.io with ``flyctl auth login``
3. Run ``flyctl launch`` to create a new app on Fly.io and configure it.
It will ask you to select a region and a name for your app. When done it will
create a ``fly.toml`` file and a ``Dockerfile`` in your project directory.
4. Set ``EDGEDB_INSTANCE`` and ``EDGEDB_SECRET_KEY`` as secrets in your Fly.io
app.

For **runtime secrets**, you can do this by running the following commands:

.. code-block:: bash
$ flyctl secrets set EDGEDB_INSTANCE <EDGEDB_INSTANCE>
$ flyctl secrets set EDGEDB_SECRET_KEY <EDGEDB_SECRET_KEY>
`Read more about Fly.io runtime secrets
<https://fly.io/docs/reference/secrets/>`_.

For **build secrets**, you can do this by modifying the ``Dockerfile`` to
mount the secrets as environment variables.

.. code-block:: dockerfile-diff
:caption: Dockerfile
# Build application
- RUN pnpm run build
+ RUN --mount=type=secret,id=EDGEDB_INSTANCE \
+ --mount=type=secret,id=EDGEDB_SECRET_KEY \
+ EDGEDB_INSTANCE="$(cat /run/secrets/EDGEDB_INSTANCE)" \
+ EDGEDB_SECRET_KEY="$(cat /run/secrets/EDGEDB_SECRET_KEY)" \
+ pnpm run build
`Read more about Fly.io build secrets
<https://fly.io/docs/reference/build-secrets/>`_.

5. Deploy your app to Fly.io

.. code-block:: bash
$ flyctl deploy
If your app requires build secrets, you can pass them as arguments
to the ``deploy`` command:

.. code-block:: bash
$ flyctl deploy --build-secret EDGEDB_INSTANCE="<EDGEDB_INSTANCE>" \
--build-secret EDGEDB_SECRET_KEY="<EDGEDB_SECRET_KEY>"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/guides/cloud/deploy/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ platform-specific instructions:

vercel
netlify
fly
railway
render
6 changes: 3 additions & 3 deletions docs/guides/cloud/deploy/netlify.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _ref_guide_cloud_deploy_netlify:

========================
Deploy an app on Netlify
========================
=======
Netlify
=======

:edb-alt-title: Deploying applications built on EdgeDB Cloud to Netlify

Expand Down
27 changes: 27 additions & 0 deletions docs/guides/cloud/deploy/railway.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. _ref_guide_cloud_deploy_railway:

=======
Railway
=======

:edb-alt-title: Deploying applications built on EdgeDB Cloud to Railway

1. Push project to GitHub or some other Git remote repository
2. Create and make note of a secret key for your EdgeDB Cloud instance
3. From Railway's dashboard, click the "New Project" button
4. Select the repository you want to deploy
5. Click the "Add variables" button to add the following environment variables:

- ``EDGEDB_INSTANCE`` containing your EdgeDB Cloud instance name (in
``<org>/<instance-name>`` format)
- ``EDGEDB_SECRET_KEY`` containing the secret key you created and noted
previously.

6. Click "Deploy"

.. image:: images/cloud-railway-config.png
:width: 100%
:alt: A screenshot of the Railway deployment configuration view
highlighting the environment variables section where a user will
need to set the necessary variables for EdgeDB Cloud instance
connection.
28 changes: 28 additions & 0 deletions docs/guides/cloud/deploy/render.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _ref_guide_cloud_deploy_render:

======
Render
======

:edb-alt-title: Deploying applications built on EdgeDB Cloud to Render

1. Push project to GitHub or some other Git remote repository
2. Create and make note of a secret key for your EdgeDB Cloud instance
3. From Render's dashboard, click "New > Web Service"
4. Import your project's repository
5. In the setup page, scroll down to the "Environment Variables" section and
add the following environment variables:

- ``EDGEDB_INSTANCE`` containing your EdgeDB Cloud instance name (in
``<org>/<instance-name>`` format)
- ``EDGEDB_SECRET_KEY`` containing the secret key you created and noted
previously.

6. Click Deploy

.. image:: images/cloud-render-config.png
:width: 100%
:alt: A screenshot of the Render deployment configuration view
highlighting the environment variables section where a user
will need to set the necessary variables for EdgeDB Cloud instance
connection.
6 changes: 3 additions & 3 deletions docs/guides/cloud/deploy/vercel.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _ref_guide_cloud_deploy_vercel:

=======================
Deploy an app on Vercel
=======================
======
Vercel
======

:edb-alt-title: Deploying applications built on EdgeDB Cloud to Vercel

Expand Down
3 changes: 3 additions & 0 deletions docs/guides/cloud/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ interface nearly identical to the :ref:`EdgeDB UI <ref_cli_edgedb_ui>`.
deploy/index
deploy/vercel
deploy/netlify
deploy/fly
deploy/render
deploy/railway


Questions? Problems? Bugs?
Expand Down
3 changes: 2 additions & 1 deletion tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ def run_block_test(self, block):
'tsx',
'elixir',
'toml',
'sql'
'sql',
'dockerfile'
}:
pass
elif lang[-5:] == '-diff':
Expand Down

0 comments on commit 90cdbf8

Please sign in to comment.