-
Notifications
You must be signed in to change notification settings - Fork 87
docs: Rework the Build your first app guide for 3.5 #557
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
6 commits
Select commit
Hold shift + click to select a range
88065dc
docs: Rewrite first-app pages 1-2 for 3.5 (serverpod start, hot reloa…
developerjamiu 0a29ea5
docs: Rewrite first-app database and deploy pages for 3.5
developerjamiu debe4d3
docs: Apply review polish to Build your first app pages
developerjamiu a79089e
docs: Update first-app screenshots and add the serverpod start TUI image
developerjamiu 1dd5ac7
docs: Lift the Press R hot-restart instruction out into a visible action
developerjamiu 841dc23
docs: Update the page 2 result screenshot
developerjamiu 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
455 changes: 105 additions & 350 deletions
455
docs/05-build-your-first-app/03-working-with-the-database.md
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,39 +1,57 @@ | ||
| --- | ||
| sidebar_label: Deploy your server | ||
| title: Deploy your app | ||
| sidebar_class_name: sidebar-icon-get-started-step-4 | ||
| slug: /get-started/deployment | ||
| description: Deploy your Serverpod recipe app to Serverpod Cloud with the scloud CLI, then explore other hosting options. | ||
| --- | ||
|
|
||
| # Deploy your server | ||
| <!-- markdownlint-disable MD025 --> | ||
|
|
||
| ## Server requirements | ||
| # Deploy your app | ||
|
|
||
| Serverpod is written in Dart and compiles to native code, allowing it to run on any platform supported by the [Dart tooling](https://dart.dev/get-dart#system-requirements). | ||
| Your recipe app runs locally. The last step is to put it online. The recommended path is [Serverpod Cloud](/cloud), which hosts your server and database with zero configuration. | ||
|
|
||
| Many users prefer to deploy Serverpod using Docker. The project includes a basic Dockerfile that you can use to build a Docker image, which can then be run on any Docker-compatible platform. | ||
| ## Deploy to Serverpod Cloud | ||
|
|
||
| For non-Docker deployments, you'll need to [compile the Dart code](https://dart.dev/tools/dart-compile) and manually copy your assets and configuration files to the server. This manual step is necessary since [asset bundling is not yet supported by Dart](https://github.com/dart-lang/sdk/issues/55195). | ||
| Install the Serverpod Cloud CLI: | ||
|
|
||
| ## Server configuration | ||
| ```bash | ||
| $ dart pub global activate serverpod_cloud_cli | ||
| ``` | ||
|
|
||
| By default Serverpod is active on three ports: | ||
| From your project's root folder, launch the app. This creates a Cloud project, provisions a managed Postgres database (separate from the embedded one `serverpod start` runs locally), and deploys your server along with the web build of your app: | ||
|
|
||
| - **8080**: The main port for the server - this is where the generated client will connect to. | ||
| - **8081**: The port for connecting with the [Serverpod Insights](../tools/insights) tooling. You may want to restrict which IP addresses can connect to this port. | ||
| - **8082**: The built in webserver is running on this port. | ||
| ```bash | ||
| $ scloud launch | ||
| ``` | ||
|
|
||
| You will also need to configure the database connection in the `config/production.yaml` file and **securely** provide the `config/passwords.yaml` file to the server. | ||
| The first upload includes your Flutter web build and can exceed the default timeout on a slower connection. If the upload times out, retry with a higher limit (in seconds), for example, `scloud launch --timeout 600`. | ||
|
|
||
| ## Health checks | ||
| Your Gemini API key lives in `passwords.yaml`, which stays on your machine and is never deployed. Set it as a secret in Cloud so the deployed server can call Gemini: | ||
|
|
||
| The server exposes a health check on the root endpoint `/` on port **8080**. Load balancers and monitoring systems can use this endpoint to verify that your server is running and healthy. The endpoint returns a basic health status response. | ||
| ```bash | ||
| $ scloud password set geminiApiKey | ||
| ``` | ||
|
|
||
| ## Deploying with Serverpod Cloud | ||
| Whenever you make changes later, redeploy with: | ||
|
|
||
| Serverpod Cloud is a managed service that allows you to deploy your Serverpod applications without having to worry about the underlying infrastructure. | ||
| ```bash | ||
| $ scloud deploy | ||
| ``` | ||
|
|
||
| Serverpod Cloud is currently in private beta. Request access by [filling out this form](https://docs.google.com/forms/d/e/1FAIpQLSfBteB7hoLJ2xPgs0CXj9RpLt2gogvJZSpEv2ye8ziWuXfGFA/viewform). Once you have access, you can deploy your Serverpod applications to the cloud in just a few minutes and with zero configuration. | ||
| See the [Serverpod Cloud documentation](/cloud) for the full walkthrough, including custom domains, logs, and your free trial. | ||
|
|
||
| ## Other deployment options | ||
|
|
||
| Check out [Custom hosting](../08-deployments/custom-hosting/01-choosing-a-strategy.md) for more information on how to deploy your Serverpod application to other platforms. | ||
| Prefer to host the server yourself? See [Custom hosting](../08-deployments/custom-hosting/01-choosing-a-strategy.md) for running on a server cluster, a serverless platform, or your own machine. | ||
|
|
||
| ## What you've built | ||
|
|
||
| You've built and deployed a full-stack app with Flutter and Serverpod: | ||
|
|
||
| - A custom endpoint that calls an external API from the server. | ||
| - A type-safe data model shared between the server and the Flutter app. | ||
| - Persistent storage with the database. | ||
| - A Flutter app that talks to your server through the generated client. | ||
|
|
||
| We're excited to see what you'll build next. If you need help, join the [Discord community](https://serverpod.dev/discord) or ask in our [community on GitHub](https://github.com/serverpod/serverpod/discussions). To go deeper into any topic, browse the [Concepts](../06-concepts/01-working-with-endpoints/01-working-with-endpoints.md) section. |
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.
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.
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.