-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Thymis-io/chore/adjust-for-landing-page-bu…
…ild-and-add-docs Chore/adjust for landing page build and add docs
- Loading branch information
Showing
26 changed files
with
287 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # To push a branch | ||
pages: write # To push to a GitHub Pages site | ||
id-token: write # To update the deployment status | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install latest mdbook | ||
run: | | ||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | ||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | ||
mkdir mdbook | ||
curl -sSL $url | tar -xz --directory=./mdbook | ||
echo `pwd`/mdbook >> $GITHUB_PATH | ||
- name: Build Book | ||
run: | | ||
# This assumes your book is in the root of your repository. | ||
# Just add a `cd` here if you need to change to another directory. | ||
cd docs | ||
mdbook build | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
# Upload entire repository | ||
path: 'docs/book' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains 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,3 +1,6 @@ | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv(verbose=True) | ||
|
||
from thymis_controller.crud.project import Project | ||
from thymis_controller.models import State, Device, Module, ModuleSettings, SettingValue |
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import json | ||
from pydoc import locate | ||
from pathlib import Path | ||
from thymis_controller.models.state import State | ||
import os | ||
|
||
|
||
class Project: | ||
def __init__(self, path): | ||
self.path = path | ||
|
||
def is_initialized(self): | ||
return Path(self.path).is_dir() and (Path(self.path) / "state.json").is_file() | ||
|
||
def initialize(self): | ||
Path(self.path).mkdir(exist_ok=True) | ||
# TODO git reop init - git config user and email | ||
state = State( | ||
version="0.0.1", | ||
tags=[], | ||
devices=[], | ||
) | ||
self.update_state(state.model_dump()) | ||
|
||
def load_state_from_file(self): | ||
with open(Path(self.path) / "state.json", "r", encoding="utf-8") as f: | ||
state_dict = json.load(f) | ||
return State.load_from_dict(state_dict) | ||
|
||
def update_state(self, state): | ||
old_state = self.load_state_from_file() | ||
try: | ||
state = State.load_from_dict(state) | ||
state.save(self.path) | ||
state.write_nix(self.path) | ||
except Exception as e: | ||
old_state.save(self.path) | ||
old_state.write_nix(self.path) | ||
raise e | ||
|
||
|
||
REPO_PATH = os.getenv("REPO_PATH") | ||
global_project = Project(REPO_PATH) |
This file was deleted.
Oops, something went wrong.
This file contains 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,8 +1,13 @@ | ||
from thymis_controller.crud import state | ||
from fastapi import Depends | ||
from thymis_controller.crud.project import Project, global_project | ||
|
||
|
||
def get_or_init_state(): | ||
if not state.is_initialized(): | ||
state.initialize() | ||
def get_or_init_project(): | ||
if not global_project.is_initialized(): | ||
global_project.initialize() | ||
|
||
return state.load_from_file() | ||
return global_project | ||
|
||
|
||
def get_or_init_state(project: Project = Depends(get_or_init_project)): | ||
return project.load_state_from_file() |
This file contains 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,5 +1,6 @@ | ||
from .setting import Setting, ModuleSettings | ||
from .setting import Setting, ModuleSettings, SettingValue | ||
from .module import Module | ||
from .modules import ALL_MODULES | ||
from .tag import Tag | ||
from .device import Device | ||
from .state import State |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
book |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[book] | ||
authors = ["Eli Kogan-Wang"] | ||
language = "en" | ||
multilingual = false | ||
src = "src" | ||
title = "Thymis Documentation" |
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Summary | ||
|
||
[Introduction](introduction.md) | ||
|
||
- [Getting Started](getting_started.md) | ||
- [Creating a Thymis-Controller Device Image](getting_started/creating_a_thymis_controller_device_image.md) | ||
- [Running the Thymis-Controller Device Image](getting_started/running_the_thymis_controller_device_image.md) | ||
- [Configuration](configuration.md) | ||
- [Adding a Device](configuration/adding_a_device.md) | ||
- [Managing Devices using Tags](configuration/managing_devices_using_tags.md) | ||
- [Configure Pre-Defined Modules](configuration/configure_pre_defined_modules.md) | ||
- [Adding custom Modules](configuration/adding_custom_modules.md) | ||
- [Deployment](deployment.md) | ||
- [Deployment History](deployment/history.md) | ||
- [Monitoring](monitoring.md) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Configuration | ||
|
||
Once you have your Thymis-Controller device up and running, you can start configuring the Thymis Project to suit your needs. | ||
Quickly [add devices](configuration/adding_a_device.md), [manage devices using tags](configuration/managing_devices_using_tags.md), [configure pre-defined modules](configuration/configure_pre_defined_modules.md), and [add custom modules](configuration/adding_custom_modules.md) to your Thymis Project. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Adding a Device | ||
|
||
To add a device to Thymis, follow these steps: | ||
|
||
1. Navigate to the Thymis-Controller web interface. | ||
2. Click on the "Devices" tab. | ||
3. Click on the "Add Device" button. | ||
4. Follow the on-screen instructions to add the device to your Thymis Project. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Adding custom Modules | ||
|
||
TODO | ||
|
||
You can add custom modules to your Thymis Project to extend the functionality of your IoT devices. | ||
|
||
To add a custom module to your Thymis Project, follow these steps: | ||
|
||
1. Navigate to the Thymis-Controller web interface. | ||
2. Click on the "Modules" tab. | ||
3. Click on the "Add Module" button. | ||
4. Enter the module name and description. | ||
5. Click on the "Add Module" button. | ||
6. Follow the on-screen instructions to add the module to your Thymis Project. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Configure Pre-Defined Modules | ||
|
||
Thymis comes with a set of pre-defined modules that you can use to extend the functionality of your IoT devices. You can configure these modules to suit your needs. | ||
|
||
To configure a pre-defined module, follow these steps: | ||
|
||
1. Navigate to the Thymis-Controller web interface. | ||
2. Click on the "Devices" tab. | ||
3. Click the "Edit" button next to the device you want to configure. | ||
4. Add the pre-defined module to the device by clicking on the "Add Module" button. | ||
5. Configure the module by entering the required information. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Managing Devices using Tags | ||
|
||
Tags are a powerful way to manage your devices in Thymis. | ||
You can use tags to group devices together, filter devices based on specific criteria, and perform actions on multiple devices at once. | ||
|
||
## Adding Tags to a Device | ||
|
||
To add tags to a device, follow these steps: | ||
|
||
1. Navigate to the Thymis-Controller web interface. | ||
2. Click on the "Devices" tab. | ||
3. Add tags to a device using the UI-Elements in the `Tags` column. | ||
|
||
## Managing Tags | ||
|
||
You can assign and configure modules for your Tags in the same way you would for individual devices. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Deployment | ||
|
||
Click the Deploy button to deploy your Thymis Project to your IoT devices. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Deployment Versioning | ||
|
||
Thymis keeps track of past deployments and allows you to revert to a previous deployment if needed. | ||
This feature is useful when you need to roll back to a previous version of your Thymis Project. | ||
|
||
See the History tab in the Thymis-Controller web interface for more information. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Getting Started | ||
|
||
In order to get started with Thymis, you need to create a Thymis-Controller image and run it on your machine. | ||
|
||
Follow the instructions below to create a Thymis-Controller image. | ||
|
||
- [Creating a Thymis-Controller Device Image](getting_started/creating_a_thymis_controller_device_image.md) | ||
- [Running the Thymis-Controller Device Image](getting_started/running_the_thymis_controller_device_image.md) |
32 changes: 32 additions & 0 deletions
32
docs/src/getting_started/creating_a_thymis_controller_device_image.md
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Creating a Thymis-Controller Device Image | ||
|
||
You can create a Thymis-Controller device image on the Thymis website. | ||
|
||
To create a Thymis-Controller device image, follow these steps: | ||
|
||
## Choose a Device | ||
|
||
Choose the type of device that you want to create a Thymis-Controller image for. | ||
|
||
Currently, the Thymis-Controller supports the following devices: | ||
|
||
- Raspberry Pi 4 | ||
- Generic x86_64 device | ||
|
||
## Add Device Information | ||
|
||
Give your device a name and add any additional information that you want to include in the device image. | ||
|
||
## Add network configuration | ||
|
||
Add network configuration to the device image. | ||
|
||
## Add SSH keys | ||
|
||
Add SSH keys to the device image. | ||
|
||
## Generate the Image | ||
|
||
Click the "Generate Image" button to generate the device image. | ||
|
||
Follow the instructions on the Thymis website to download the device image and flash it to an SD card/USB drive/Bootable disk. |
13 changes: 13 additions & 0 deletions
13
docs/src/getting_started/running_the_thymis_controller_device_image.md
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Running the Thymis-Controller Device Image | ||
|
||
Once you have created, downloaded, and flashed the Thymis-Controller device image to an SD card/USB drive/Bootable disk, you can run it on your machine. | ||
|
||
Follow your device's instructions to boot from the SD card/USB drive/Bootable disk. | ||
|
||
Once the device has booted, you will see a screen that looks like this: | ||
|
||
![Thymis-Controller Device Image](images/thymis-controller-device-image.png) | ||
|
||
You can connect to the Thymis-Controller using the address shown on the screen, using the credentials that you set when you created the device image. | ||
|
||
Once you have connected to the Thymis-Controller, you can start generating, deploying, and managing your IoT devices. |
Oops, something went wrong.