|
1 | 1 | # Deployment |
2 | 2 |
|
3 | | -This page is only relevant for the maintainer(s) of this project. |
4 | | - |
5 | | -## Hosting |
6 | | - |
7 | | -The application is deployed on [Netlify](https://netlify.com). The database is hosted on [Turso](https://turso.tech). |
| 3 | +This page is only relevant to the maintainer(s) of this project. |
8 | 4 |
|
9 | 5 | - [GitHub repository](https://github.com/ScriptRaccoon/catdat) |
10 | 6 | - [Netlify project](https://app.netlify.com/sites/catdat/overview) |
11 | 7 |
|
12 | 8 | ## Prerendering |
13 | 9 |
|
14 | | -Most pages are prerendered for performance reasons. This implies that the database is consumed at build time to generate static HTML pages. The only non-prerendered pages are the search and comparison pages, since they involve a dynamic list of properties and categories. |
| 10 | +Most pages are prerendered for performance reasons. This implies that the database is consumed at build time to generate static HTML pages. The only non-prerendered pages are the search and comparison pages, since they involve dynamic lists of properties and categories. |
| 11 | + |
| 12 | +## Databases |
15 | 13 |
|
16 | | -## Preview Database |
| 14 | +The CatDat SQLite database `catdat.db` is deployed as a file alongside the web application to Netlify and is located at `/var/task/databases/catdat/catdat.db` after deployment. The file system on Netlify is ephemeral, so this only works because the database is read-only during the runtime of the application. |
17 | 15 |
|
18 | | -Since deployment requires running `pnpm db:update`, which temporarily clears all tables in the database, we maintain a separate remote database `catdat-preview` on Turso as a copy of the production database `catdat`. This prevents temporary disruptions and data inconsistencies in production. |
| 16 | +However, the SQLite database `app.db` (used for user submissions and page visits) requires writes and is hosted remotely on [Turso](https://turso.tech). |
19 | 17 |
|
20 | 18 | ## Deployment Process |
21 | 19 |
|
22 | 20 | Follow these steps to deploy to production: |
23 | 21 |
|
24 | | -1. **Preview Deployment.** On [GitHub's actions page](https://github.com/ScriptRaccoon/CatDat/actions), manually trigger the preview pipeline [deploy-preview.yaml](.github/workflows/deploy-preview.yaml). |
25 | | - |
26 | | -It updates the remote preview database (`catdat-preview`) via `pnpm db:update`, builds the application, and creates a [deployment preview](https://docs.netlify.com/deploy/deploy-types/deploy-previews/) on Netlify. The production database and application remain unchanged in this step. |
27 | | - |
28 | | -2. **Promote to Production.** If the deployment preview looks correct, promote it to production in [Netlify's Deploys UI](https://app.netlify.com/projects/catdat/deploys). |
29 | | - |
30 | | -The updated application goes live and uses the preview database. |
| 22 | +1. **Preview Deployment.** On [GitHub's Actions page](https://github.com/ScriptRaccoon/CatDat/actions), manually trigger the preview pipeline [deploy-preview.yaml](.github/workflows/deploy-preview.yaml). |
31 | 23 |
|
32 | | -3. **Production Deployment.** On [GitHub's actions page](https://github.com/ScriptRaccoon/CatDat/actions), manually trigger the pipeline [deploy-prod.yaml](.github/workflows/deploy-prod.yaml). |
| 24 | + It creates the database via `pnpm db:update`, builds the application, and creates a [deployment preview](https://docs.netlify.com/deploy/deploy-types/deploy-previews/) on Netlify. For testing purposes, this step can also be used on branches other than `main`. |
33 | 25 |
|
34 | | -This pipeline updates the remote production database (`catdat`) via `pnpm db:update` (hence, consolidates it with the preview database `catdat-preview`), builds the application, and deploys it on Netlify. The previous deployment preview is no longer live. |
| 26 | +2. **Production Deployment.** If the deployment preview looks correct, on [GitHub's Actions page](https://github.com/ScriptRaccoon/CatDat/actions), manually trigger the pipeline [deploy-prod.yaml](.github/workflows/deploy-prod.yaml). |
35 | 27 |
|
36 | | -In case only the application, not the database has been updated since the last production deployment, the pipeline [deploy-prod-skip-db](.github/workflows/deploy-prod-skip-db.yaml) can be used. The preview deployment is not required. |
| 28 | + This pipeline creates the database via `pnpm db:update`, builds the application, and deploys it on Netlify. The previous deployment preview is no longer live. Moreover, a tag is created on GitHub. |
37 | 29 |
|
38 | 30 | ## Domains |
39 | 31 |
|
|
0 commit comments