diff --git a/docs/go/tutorials/graphql.mdx b/docs/go/tutorials/graphql.mdx index f114b582b8..674ffc666a 100644 --- a/docs/go/tutorials/graphql.mdx +++ b/docs/go/tutorials/graphql.mdx @@ -254,7 +254,43 @@ query { And you should get back `https://encore.dev`. -## 7. Deploy to the cloud + +## 7. Deploy + + + +### Self-hosting + +Encore supports building Docker images directly from the CLI, which can then be self-hosted on your own infrastructure of choice. + +If your app is using infrastructure resources, such as SQL databases, Pub/Sub, or metrics, you will need to supply a [runtime configuration](/docs/go/self-host/configure-infra) your Docker image. + +🥐 Build a Docker image by running `encore build docker graphql:v1.0`. + +This will compile your application using the host machine and then produce a Docker image containing the compiled application. + +🥐 Upload the Docker image to the cloud provider of your choice and run it. + + + + + +### Deploy to Encore Cloud + +Encore Cloud provides automated infrastructure and DevOps. Deploy to a free development environment or to your own cloud account on AWS or GCP. + +### Create account + +Before deploying with Encore Cloud, you need to have a free Encore Cloud account and link your app to the platform. If you already have an account, you can move on to the next step. + +If you don’t have an account, the simplest way to get set up is by running `encore app create` and selecting **Y** when prompted to create a new account. Once your account is set up, continue creating a new app, selecting the `empty app` template. + +After creating the app, copy your project files into the new app directory, ensuring that you do not replace the `encore.app` file (this file holds a unique id which links your app to the platform). + +### Commit changes + +The final step before you deploy is to commit all changes to the project repo. + Push your changes and deploy your application to Encore's free development cloud by running: @@ -282,6 +318,8 @@ _From here you can easily access all Cloud Dashboard features and for example ju ![Fireworks](/assets/docs/fireworks.jpg) + + ## Conclusion We've now built a GraphQL API gateway that forwards requests to the application's diff --git a/docs/go/tutorials/rest-api.mdx b/docs/go/tutorials/rest-api.mdx index 244a3a56b5..19097a9ac8 100644 --- a/docs/go/tutorials/rest-api.mdx +++ b/docs/go/tutorials/rest-api.mdx @@ -305,7 +305,61 @@ func TestShortenAndRetrieve(t *testing.T) { If you use the local development dashboard ([localhost:9400](http://localhost:9400)), you can even see traces for tests. -## 5. Deploy to the cloud +## 5. Deploy + + + +### Self-hosting + +Encore supports building Docker images directly from the CLI, which can then be self-hosted on your own infrastructure of choice. + +If your app is using infrastructure resources, such as SQL databases, Pub/Sub, or metrics, you will need to configure your Docker image with the necessary configuration. +Our URL shortener makes use of a PostgreSQL database, so we'll need to supply a [runtime configuration](/docs/go/self-host/configure-infra) so that our app knows how to connect to the database in the cloud. + +🥐 Create a new file `infra-config.json` in the root of your project with the following contents: + +```json +{ + "$schema": "https://encore.dev/schemas/infra.schema.json", + "sql_servers": [ + { + "host": "my-db-host:5432", + "databases": { + "url": { + "username": "my-db-owner", + "password": {"$env": "DB_PASSWORD"} + } + } + } + ] +} +``` + +The values in this configuration are just examples, you will need to replace them with the correct values for your database. + +🥐 Build a Docker image by running `encore build docker url-shortener:v1.0`. + +This will compile your application using the host machine and then produce a Docker image containing the compiled application. + +🥐 Upload the Docker image to the cloud provider of your choice and run it. + + + + + +### Encore Cloud (free) + +Encore Cloud provides automated infrastructure and DevOps. Deploy to a free development environment or to your own cloud account on AWS or GCP. + +### Create account + +Before deploying with Encore Cloud, you need to have a free Encore Cloud account and link your app to the platform. If you already have an account, you can move on to the next step. + +If you don’t have an account, the simplest way to get set up is by running `encore app create` and selecting **Y** when prompted to create a new account. Once your account is set up, continue creating a new app, selecting the `empty app` template. + +After creating the app, copy your project files into the new app directory, ensuring that you do not replace the `encore.app` file (this file holds a unique id which links your app to the platform). + +### Commit changes The final step before you deploy is to commit all changes to the project repo. @@ -341,10 +395,12 @@ _From here you can easily access all Cloud Dashboard features and for example ju ![Fireworks](/assets/docs/fireworks.jpg) +🥐 A great next step is to [integrate with GitHub](/docs/platform/integrations/github). Once you've linked with GitHub, Encore will automatically start building and running tests against your Pull Requests. + + + ## What's next Now that you know how to build a backend with a database, you're ready to let your creativity flow and begin building your next great idea! -🥐 A great next step is to [integrate with GitHub](/docs/platform/integrations/github). Once you've linked with GitHub, Encore will automatically start building and running tests against your Pull Requests. - We're excited to hear what you're going to build with Encore, join the pioneering developer community on [Discord](/discord) and share your story. diff --git a/docs/go/tutorials/uptime.md b/docs/go/tutorials/uptime.md index 281dcd99b8..f4384479af 100644 --- a/docs/go/tutorials/uptime.md +++ b/docs/go/tutorials/uptime.md @@ -592,9 +592,66 @@ func Status(ctx context.Context) (*StatusResponse, error) { Now try visiting http://localhost:4000/frontend in your browser again. This time you should see a working frontend that lists all sites and their current status. -## 5. Deploy to Encore's development cloud +## 5. Deploy -To try out your uptime monitor for real, let's deploy it to Encore's free development cloud. +To try out your uptime monitor for real, let's deploy it to the cloud. + + + +### Self-hosting + +Encore supports building Docker images directly from the CLI, which can then be self-hosted on your own infrastructure of choice. + +If your app is using infrastructure resources, such as SQL databases, Pub/Sub, or metrics, you will need to supply a [runtime configuration](/docs/go/self-host/configure-infra) your Docker image. + +🥐 Create a new file `infra-config.json` in the root of your project with the following contents: + +```json +{ + "$schema": "https://encore.dev/schemas/infra.schema.json", + "sql_servers": [ + { + "host": "my-db-host:5432", + "databases": { + "monitor": { + "username": "my-db-owner", + "password": {"$env": "DB_PASSWORD"} + }, + "site": { + "username": "my-db-owner", + "password": {"$env": "DB_PASSWORD"} + } + } + } + ] +} +``` + +The values in this configuration are just examples, you will need to replace them with the correct values for your database. + +🥐 Build a Docker image by running `encore build docker uptime:v1.0`. + +This will compile your application using the host machine and then produce a Docker image containing the compiled application. + +🥐 Upload the Docker image to the cloud provider of your choice and run it. + + + + + +### Encore Cloud (free) + +Encore Cloud provides automated infrastructure and DevOps. Deploy to a free development environment or to your own cloud account on AWS or GCP. + +### Create account + +Before deploying with Encore Cloud, you need to have a free Encore Cloud account and link your app to the platform. If you already have an account, you can move on to the next step. + +If you don’t have an account, the simplest way to get set up is by running `encore app create` and selecting **Y** when prompted to create a new account. Once your account is set up, continue creating a new app, selecting the `empty app` template. + +After creating the app, copy your project files into the new app directory, ensuring that you do not replace the `encore.app` file (this file holds a unique id which links your app to the platform). + +### Commit changes Encore comes with built-in CI/CD, and the deployment process is as simple as a `git push`. (You can also integrate with GitHub to activate per Pull Request Preview Environments, learn more in the [CI/CD docs](/docs/platform/deploy/deploying).) @@ -621,6 +678,7 @@ From the Cloud Dashboard you can also see metrics, trigger Cron Jobs, see traces *You now have an Uptime Monitor running in the cloud, well done!* + ## 6. Publish Pub/Sub events when a site goes down @@ -839,6 +897,24 @@ var _ = pubsub.NewSubscription(monitor.TransitionTopic, "slack-notification", pu Now you're ready to deploy your finished Uptime Monitor, complete with a Slack integration. + + +### Self-hosting + +Because we have added more infrastructure to our app, we need to [update the configuration](/docs/go/self-host/configure-infra) in our `infra-config.json` to include the new Pub/Sub topic and subscription as well as how we should set the `SlackWebhookURL` secret. + +🥐 Update your `ìnfra-config.json` to reflect the new infrastructure. + +🥐 Build a Docker image by running `encore build docker uptime:v2.0`. + +🥐 Upload the Docker image to the cloud provider and run it. + + + + + +### Encore Cloud (free) + 🥐 As before, deploying your app to the cloud is as simple as running: ```shell @@ -859,6 +935,8 @@ _From here you can easily access all Cloud Dashboard features and for example ju ![Fireworks](/assets/docs/fireworks.jpg) + + ## Conclusion We've now built a fully functioning uptime monitoring system.