Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/build/components/assertions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
The CLI conducts several assertions when interacting with your Satellite, one of which involves monitoring the heap memory size. Typically, the CLI checks to ensure that the heap memory does not exceed the 1 GB limit before deployment. For instance, if your heap memory usage is close to 900 MB, the CLI will prompt you to confirm the deployment.

You can customize this behavior by adjusting the heap memory limit in bytes. For example, to set a new limit of 678 MB, update your configuration as follows:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
assertions: {
heapMemory: 678000000
}
}
});
```

Alternatively, these checks can be completely disabled. To do so, set the `heapMemory` assertion to `false`:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
assertions: {
heapMemory: false
}
}
});
```
27 changes: 27 additions & 0 deletions docs/build/components/encoding.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
When deploying, the CLI automatically maps the encoding type based on the file extension. The encoding information is then used in the satellite to provide the appropriate HTTP response header `Content-Encoding`.

The default mappings are as follows:

- `.Z` = `compress`
- `.gz` = `gzip`
- `.br` = `br`
- `.zlib` = `deflate`
- rest = `identity` (no compression)

You can also customize the encoding behavior by using the "encoding" attribute in the configuration file.

This attribute works similarly to Git's `.gitignore`, and you can specify which files to ignore using globs.

Here is an example of how the "encoding" attribute can be utilized:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
encoding: [["**/releases/*.gz", "identity"]]
}
});
```
31 changes: 31 additions & 0 deletions docs/build/components/gzip.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), and CSS (css) files in the `source` folder and optimizes them using Gzip compression. This is useful because neither the protocol nor a satellite can compress these files, ensuring the best web performance.

If you wish to customize this behavior, you have the option to disable it or provide a different file matching pattern using glob syntax.

To opt-out of Gzip compression, simply set the `gzip` option to `false` in your configuration:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
gzip: false
}
});
```

If you want to customize the default pattern `**/*.+(css|js|mjs)` to better suit your needs, you can specify your own pattern. For example:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
gzip: "**/*.jpg"
}
});
```
47 changes: 47 additions & 0 deletions docs/build/components/http-headers.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Headers allow the client and the satellite to pass additional information along with a request or a response. Some sets of headers can affect how the browser handles the page and its content.

For instance, you may want to set a specific `Cache-Control` for performance reasons.

Here's an example of the `headers` object:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
storage: {
headers: [
{
source: "/",
headers: [["Cache-Control", "public,max-age=0,must-revalidate"]]
},
{
source: "assets/fonts/*",
headers: [["Cache-Control", "max-age=31536000"]]
},
{
source: "**/*.jpg",
headers: [
["Cache-Control", "max-age=31536000"],
["Access-Control-Allow-Origin", "*"]
]
}
]
}
}
});
```

This `source` attribute works similarly to Git's `.gitignore`, and you can specify which files match the headers using globs.

The `headers` is an array of objects, each containing `key` and `value`, and these apply to the matching paths.

:::note

- The `Content-Type` header is calculated automatically and cannot be altered.
- No validation or check for uniqueness is performed. For example, if a header matches a file based on multiple rules, multiple headers will be set.
- Likewise, if you provide the same header when you [upload](https://juno.build/docs/build/storage#upload-asset) file to your "Storage" and within the configuration, both headers will be set in the response.

:::
17 changes: 17 additions & 0 deletions docs/build/components/iframe.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
For security reasons and to prevent click-jacking attacks, dapps deployed with Juno are, by default, set to deny embedding in other sites.

You can customize this behavior by setting the `iframe` option to either `same-origin`, which restricts your pages to be displayed only if all ancestor frames have the same origin as the page itself, or `allow-any`, which allows your project to be embeddable by any site.

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
storage: {
iframe: "same-origin"
}
}
});
```
17 changes: 17 additions & 0 deletions docs/build/components/ignore-files.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The `ignore` attribute allows you to exclude certain files from being deployed to your satellite.

This attribute works similarly to Git's `.gitignore`, and you can specify which files to ignore using globs.

Here is an example of how the ignore attribute can be utilized:

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
ignore: ["**/*.txt", ".tmp/"]
}
});
```
31 changes: 31 additions & 0 deletions docs/build/components/redirects.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs. For example, you could redirect a browser from `juno.build/start-building` to `juno.build/get-started.html`.

Here's the basic structure for a `redirects` attribute.

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
storage: {
redirects: [
{
source: "/hello",
location: "/world/index.html",
code: 300
}
]
}
}
});
```

The `redirects` attribute contains an array of redirect rules:

| Field | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| **source** | This `source` attribute works similarly to Git's `.gitignore`, and you can specify which files match the redirects using globs. |
| **location** | A relative path to where the browser should make a new request. |
| **code** | The HTTPS response code. Use a type of `301` for 'Moved Permanently' or `302` for 'Found' (Temporary Redirect). |
31 changes: 31 additions & 0 deletions docs/build/components/rewrites.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
You can utilize optional rewrites to display the same content for multiple URLs. Rewrites are especially useful when combined with pattern matching, allowing acceptance of any URL that matches the pattern.

Here's the basic structure for a `rewrites` attribute.

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
storage: {
rewrites: [
{
source: "/hello/**",
destination: "/hello/world.html"
}
]
}
}
});
```

This `source` attribute works similarly to Git's `.gitignore`, and you can specify which files match the rewrites using globs.

:::note

- Rewrites are only applied to requests that do not match any existing resources.
- By default, all unknown paths are automatically rewritten to `/index.html` (or `/404.html` if you provide such a page). You cannot disable this default behavior.

:::
14 changes: 14 additions & 0 deletions docs/build/components/source.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The `source` field specifies the directory containing the built assets for your satellite. This is typically the output directory of your build process, such as `/dist` or `/build`, created after running a command like `npm run build`.

Juno uses this directory to locate the files that will be deployed as part of your satellite. Ensure that this directory includes all the necessary assets, such as HTML, JavaScript, CSS, and any other static or dynamic resources your application requires.

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist"
}
});
```
32 changes: 1 addition & 31 deletions docs/build/datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,37 +483,7 @@ await deleteFilteredDocs({

## Configuration

You can configure various settings of the Datastore.

#### Where do you define your Datastore configuration?

You define your Datastore configuration in your Juno configuration file. The CLI automatically creates the file at the root of your project directory when you run the [juno init](../miscellaneous/cli.mdx#init) or [juno deploy](../miscellaneous/cli.mdx#deploy) command for the first time.

#### How do you apply your changes?

To apply any changes you make in your configuration to your satellite, execute the [juno config](../miscellaneous/cli.mdx#config) command with the CLI.

### Maximum Memory Size

You can configure optional limits on heap and stable memory for your smart contract to control the creation and update of documentations in your Datastore.

When the limit is reached, the Datastore and smart contract will continue to operate normally but will reject changes to documents.

```javascript
import { defineConfig } from "@junobuild/config";

export default defineConfig({
satellite: {
id: "qsgjb-riaaa-aaaaa-aaaga-cai",
source: "dist",
datastore: {
maxMemorySize: {
stable: 1_073_741_824n // For example max. 1 GiB in bytes of Stable memory
}
}
}
});
```
The Datastore supports various configuration options to fine-tune its behavior, such as resource limits and operational constraints. For a detailed explanation of all available options, see the [configuration](../miscellaneous/configuration.mdx) section.

[satellite]: ../terminology.md#satellite
[controllers]: ../terminology.md#controller
Expand Down
Loading