You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/authentication.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,3 +3,19 @@ sidebar_position: 2
3
3
---
4
4
5
5
# Authentication
6
+
7
+
Right now the only way to authenticate is with your provided JWT token.
8
+
9
+
Once you have installed the CLI in the previous step, [Installing the CLI](./installing-the-cli.md), you can authenticate by running the following command:
10
+
11
+
```sh
12
+
lttle login --api http://eu.lttle.cloud:5100 jwt
13
+
```
14
+
15
+
The only supported region is `eu`.
16
+
17
+
:::note Question
18
+
19
+
The region API endpoint for `eu` is using the http protocol. We should upgrade it to https for better security.
Copy file name to clipboardExpand all lines: docs/getting-started/deploying-a-static-site.md
+271Lines changed: 271 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,3 +3,274 @@ sidebar_position: 3
3
3
---
4
4
5
5
# Deploying a static site
6
+
7
+
In this exercise we will be deploying a simple [Astro](https://astro.build/) project using [Nginx](https://nginx.org/) to serve the static files.
8
+
9
+
Please make sure you have Node.js installed and Docker installed. We will be deploying a lttle machine that will serve outbound traffic via a lttle service.
10
+
11
+
Superficially a machine can be viewed as a container that runs somewhere in the lttle.cloud infrastructure and a service relates to traffic management and routing.
12
+
13
+
## Creating an Astro Project
14
+
15
+
To deploy a static site, you will need to have the CLI installed and be authenticated. If you haven't done that yet, please follow the previous steps: [Installing the CLI](./installing-the-cli.md) and [Authentication](./authentication.md).
16
+
17
+
In this exercise we will be deploying a simple [Astro](https://astro.build/) project. If you don't have an Astro project ready, you can create one quickly by following the [Astro documentation](https://astro.build/docs).
18
+
19
+
```bash npm2yarn
20
+
npm create astro@latest
21
+
```
22
+
23
+
Do any changes you would like to the newly generated Astro project, such as adding components, pages, or styles. Once you are satisfied with your changes, you can deploy your static site follow the next steps.
24
+
25
+
## Setting up your Code Editor / IDE
26
+
27
+
All lttle resources are defined using YAML files. To get started, we have prepared a YAML schema to facilitate resource creation. You can find it here: [resources.json](https://raw.githubusercontent.com/lttle-cloud/ignition/refs/heads/master/schemas/resources.json).
28
+
29
+
To make working with YAML files easier, you can set up your code editor or IDE with the following extensions:
30
+
31
+
### Visual Studio Code
32
+
33
+
Install the [YAML Language Support](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension for better YAML syntax highlighting and validation.
34
+
35
+
Create in the `.vscode` folder a `settings.json`, file with the following content:
In order to deploy our simple Astro project, we need to create a machine resource. Create a file called `machine.lttle.yaml` in the root of your project with the following content:
130
+
131
+
```yaml title="static-site.lttle.yaml"
132
+
machine:
133
+
namespace: static-site
134
+
name: nginx
135
+
image: username/image:tag
136
+
resources:
137
+
# The smallest number of CPUs we can actually have
138
+
cpu: 1
139
+
# The smallest amount of memory we can actually have
140
+
memory: 64
141
+
mode:
142
+
# This tells lttle.cloud that 5 seconds after nginx starts listening
143
+
# we can stop the machine if it is not receiving any traffic
144
+
flash:
145
+
timeout: 5
146
+
strategy:
147
+
listen-on-port: 80
148
+
```
149
+
150
+
More about [machines](../resources/machines.md).
151
+
152
+
:::note TODO
153
+
154
+
The dark theme does not support the yaml syntax highlighting.
155
+
156
+
:::
157
+
158
+
You can read more about the [machine resource](../resources/machines.md).
159
+
160
+
### Creating your first service
161
+
162
+
We need to have a service that it will tell lttle.cloud how to route traffic to our machine. Create a file called `service.lttle.yaml` in the root of your project with the following content:
163
+
164
+
```yaml title="service.lttle.yaml"
165
+
service:
166
+
namespace: static-site
167
+
name: ingress
168
+
target:
169
+
name: nginx
170
+
port: 80
171
+
protocol: http
172
+
connection-tracking: connection-aware
173
+
bind:
174
+
external:
175
+
host: my-static-site-eu.lttle.host
176
+
protocol: https
177
+
```
178
+
179
+
More about [services](../resources/services.md).
180
+
181
+
:::info HTTPS
182
+
183
+
All subdomains of `eu.lttle.host` are covered by our wildcard certificate.
184
+
::::
185
+
186
+
:::note TODO
187
+
188
+
We should only allow binding to `something.eu.lttle.host` by some sort of rule.
The command outputs more information about the deployment process, we only included the most relevant parts here.
243
+
244
+
:::
245
+
246
+
## Seeing your deployment in action
247
+
248
+
Once your deployment is complete, you can visit https://my-static-site-eu.lttle.host in your web browser to see your static site in action. It may take a moment for the site to become available.
249
+
250
+
To see the details of your deployment in the CLI you can run the following command:
251
+
252
+
```bash
253
+
lttle machine get --namespace static-site nginx
254
+
```
255
+
256
+
Or you could visit the [lttle.cloud | Web Console](https://console.eu.lttle.host/) to see your deployment and its details.
257
+
258
+
:::info Delay
259
+
260
+
Right now there is a bit of a delay after your machine is ready or suspended.
261
+
262
+
:::
263
+
264
+
## Final notes
265
+
266
+
In this example we have deployed a static Astro site using Nginx machine. We have attached a service to that machine that routes traffic to and from it.
267
+
268
+
We have specified that the machine should be in [flash mode](../resources/machines.md#flash-mode) with a timeout of 5 seconds and that the service should be [connection-aware](../resources/services.md#connection-aware) of the it's target (the machine).
269
+
270
+
The result of this means that the machine will be snapshotted and suspended 5 seconds after Nginx starts listening on port 80 if there is no active connection to it. When a request comes in, the machine will be resumed from the snapshot and will start serving traffic until, again, there are no active connections to it, then the machine will be re-snapshotted and suspended immediately.
271
+
272
+
This is the main functionality of lttle.cloud and it allows you to run your workloads in a cost efficient manner. For a more detailed explanation of the machine states and lifecycle, please check [Machine State Lifecycle](../machine-state-lifecycle.md).
273
+
274
+
## More scenarios
275
+
276
+
If you want to deploy more complex applications we have prepared additional [guides & samples](../guides-and-samples/introduction.md) and dynamic templates via the lttle new.
Copy file name to clipboardExpand all lines: docs/getting-started/installing-the-cli.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,3 +3,37 @@ sidebar_position: 1
3
3
---
4
4
5
5
# Installing the CLI
6
+
7
+
The easiest way is to use the install script:
8
+
9
+
```sh
10
+
curl -fsSL https://install.lttle.sh | bash
11
+
```
12
+
13
+
---
14
+
15
+
If you want to build it from source, you will need to have Rust and Cargo installed. You can find instructions on how to do that [here](https://www.rust-lang.org/tools/install).
16
+
17
+
Then you can clone the repository:
18
+
19
+
```sh
20
+
git clone git@github.com:lttle-cloud/ignition.git
21
+
```
22
+
23
+
And then you can build the project using Cargo:
24
+
25
+
```sh
26
+
cargo build --release
27
+
```
28
+
29
+
And you will find it in `target/release/lttle`.
30
+
31
+
:::info Tip
32
+
33
+
You can symlink the binary to a directory in your PATH for easier access:
0 commit comments