Project

General

Profile

Static Site Generation » History » Version 6

Olivia Reichl, 2024-07-16 15:19

1 6
h1. Static Site Generation
2
3
Our goal with OpenAtlas Discovery is to make it easily possible to host as static site once a project using it has ended. To achieve this we make use of various technologies, this document is meant as a collection for all the relevant information regarding this.
4
5
h2. Used Technologies
6
* "Nuxt3 Static Site Generation":https://nuxt.com/docs/getting-started/deployment#static-hosting
7
* "NuxtImage":https://v1.image.nuxtjs.org/
8
9
h2. Generating the Site
10
11
h3. Enviroment Variables
12
13
Enviroment variables enable us to make OA Discovery assign important variables ahead of time, like the URL of the site hosting the API for the backend. In static sites the enviroment variable "cannot be changed once it has be generated":https://nuxt.com/docs/guide/directory-structure/env#env-file, thus we need to make sure that the correct enviroment variable is provided at the time of generation. Though as we crawl the data from the backend in order to make the site static it should not pose a problem in most cases.
14
15
To work with nuxt and be available in the "nuxt runtime config":https://nuxt.com/docs/guide/going-further/runtime-config the enviroment variables need to follow the naming scheme "NUXT_PUBLIC_VAR_NAME" for public variables and "NUXT_VAR_NAME" for private ones. The naming sheme is explained in more detail "here":https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables.
16
17
h2. Generating a Static Site for the frontend-demos on the CRAWS servers
18
19
Steps: 
20
* Make sure the right environment variables are declared: NUXT_PUBLIC_API_BASE_URL &  NUXT_PUBLIC_OPEN_API_BASE_URL => are using https://demo.openatlas.eu/ or https://demo-dev.openatlas.eu/, set the NUXT_PUBLIC_SPECIAL_IMPRINT to "enabled" to render the custom imprint with Alex's email address.
21
22
* Generate the site with:
23
```
24
pnpm run generate
25
```
26
27
* zip the generated '.output'-folder and send it to Alex