mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da81aec9cc | ||
|
|
c440f637f3 | ||
|
|
9036c3ffed | ||
|
|
98a242229a | ||
|
|
74659d717a | ||
|
|
e6dbbf125c | ||
|
|
80f509a634 | ||
|
|
5d6a175585 | ||
|
|
6ef46ae309 | ||
|
|
13c94241c2 | ||
|
|
56041fd503 | ||
|
|
f52bb54a2f | ||
|
|
7f9f942eb1 | ||
|
|
1ca7a699c1 | ||
|
|
481accc9e6 |
175
BuildGuide.md
Normal file
175
BuildGuide.md
Normal file
@@ -0,0 +1,175 @@
|
||||
##### Initial Notes & Recommendations
|
||||
* Due to issues to cross-compile the image from a desktop, this guide will take you step-by-step through the process of compiling EmbassyOS directly on a Raspberry Pi 4 (4GB or 8GB)
|
||||
* This process will go faster if you have an SSD/NVMe USB drive available.
|
||||
* This build guide does **not** require a large microSD card, especially if your final build wil be used on an SSD/NVMe USB drive.
|
||||
* Basic know-how of linux commands and terminal use is recommended.
|
||||
* Follow the guide carefully and do not skip any steps.
|
||||
|
||||
# :hammer_and_wrench: Build Guide
|
||||
1. Flash [Raspberry Pi OS Lite](https://www.raspberrypi.org/software/operating-systems/) to a microSD and configure your raspi to boot from SSD/NVMe USB drive
|
||||
1. After flashing, create an empty text file called `ssh` in the `boot` partition of the microSD, then proceed with booting the raspi with the flashed microSD (check your router for the IP assigned to your raspi)
|
||||
1. Do the usual initial update/config
|
||||
```
|
||||
sudo apt update
|
||||
sudo raspi-config
|
||||
```
|
||||
1. Change `Advanced Options->Boot Order`
|
||||
1. Select `USB Boot` *(it will try to boot from microSD first if it's available)*
|
||||
1. Select `Finish`, then `Yes` to reboot
|
||||
1. After reboot, `sudo shutdown now` to power off the raspi and remove the microSD
|
||||
|
||||
2. Flash the *Raspi OS Lite* (from step 1) to your SSD/NVMe drive
|
||||
> :information_source: Don't worry about rootfs partition size (raspi will increase it for you on initial boot)
|
||||
|
||||
> :information_source: Every time you re-flash your SSD/NVMe you need to first boot with a microSD and set *Boot Order* again
|
||||
|
||||
1. Don't forget to create the empty `ssh` file
|
||||
1. Connect the drive (remember to remove the microSD) to the raspi and start it up
|
||||
1. Use `sudo raspi-config` to change the default password
|
||||
1. Optional: `sudo apt upgrade -y`
|
||||
1. Optional: `sudo nano /etc/apt/sources.list.d/vscode.list` comment the last line which contains `packages.microsoft.com`
|
||||
|
||||
3. Install GHC
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install -y ghc
|
||||
|
||||
#test:
|
||||
ghc --version
|
||||
|
||||
#example of output:
|
||||
The Glorious Glasgow Haskell Compilation System, version 8.4.4
|
||||
```
|
||||
|
||||
4. Compile Stack:
|
||||
1. Install Stack v2.1.3
|
||||
```
|
||||
cd ~/
|
||||
wget -qO- https://raw.githubusercontent.com/commercialhaskell/stack/v2.1.3/etc/scripts/get-stack.sh | sh
|
||||
|
||||
#test with
|
||||
stack --version
|
||||
|
||||
#example output:
|
||||
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) arm hpack-0.31.2
|
||||
```
|
||||
|
||||
1. Use current Stack to compile Stack v2.5.1:
|
||||
```
|
||||
git clone --depth 1 --branch v2.5.1 https://github.com/commercialhaskell/stack.git
|
||||
cd stack
|
||||
sudo apt install -y screen
|
||||
screen
|
||||
```
|
||||
> :information_source: Build (>=3.5h total... We are using `screen` in case of session timeout issues)
|
||||
|
||||
> :memo: If you get disconected you can reattach last sesion again by executing `screen -r`
|
||||
```
|
||||
stack build --stack-yaml=stack-ghc-84.yaml --system-ghc
|
||||
|
||||
#Install
|
||||
stack install --stack-yaml=stack-ghc-84.yaml --system-ghc
|
||||
export PATH=~/.local/bin:$PATH
|
||||
```
|
||||
|
||||
5. Clone EmbassyOS & try to *make* the `agent`:
|
||||
1. First attempt
|
||||
> :information_source: The first time you run **make** you'll get an error
|
||||
|
||||
```
|
||||
sudo apt install -y llvm-9 libgmp-dev
|
||||
export PATH=/usr/lib/llvm-9/bin:$PATH
|
||||
cd ~/
|
||||
git clone https://github.com/Start9Labs/embassy-os.git
|
||||
cd embassy-os/
|
||||
make agent
|
||||
```
|
||||
> :memo: This will install ghc-8.10.2, then attempt to build but will give errors (in next steps we deal with errors)
|
||||
1. Confirm your cpu info
|
||||
```
|
||||
cat /proc/cpuinfo | grep Hardware
|
||||
```
|
||||
1. If your "Hardware" is [BCM2711](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/README.md) then:
|
||||
1. Change `C compiler flags` to `-marm -mcpu=cortex-a72` in the GHC settings:
|
||||
```
|
||||
nano ~/.stack/programs/arm-linux/ghc-8.10.2/lib/ghc-8.10.2/settings
|
||||
```
|
||||
1. To prevent gcc errors we delete the `setup-exe-src` folder
|
||||
```
|
||||
rm -rf ~/.stack/setup-exe-src/
|
||||
```
|
||||
|
||||
6. Install requirements for step 7
|
||||
1. Install NVM
|
||||
```
|
||||
cd ~/ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
nvm --version
|
||||
```
|
||||
1. Install Node.js & NPM
|
||||
```
|
||||
nvm install node
|
||||
```
|
||||
1. Install Ionic CLI
|
||||
```
|
||||
npm install -g @ionic/cli
|
||||
```
|
||||
1. Install Dependencies
|
||||
```
|
||||
sudo apt-get install -y build-essential openssl libssl-dev libc6-dev clang libclang-dev libavahi-client-dev upx ca-certificates
|
||||
```
|
||||
1. Install Rust
|
||||
```
|
||||
cd ~/ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o- | bash
|
||||
|
||||
#Choose option 1
|
||||
source $HOME/.cargo/env
|
||||
|
||||
#Check rust & cargo versions
|
||||
rustc --version
|
||||
cargo --version
|
||||
```
|
||||
|
||||
7. Finally, getting to build the **.img**
|
||||
1. At this stage you hava a working development environment to build your **embassy.img**.
|
||||
Before you do that you can choose to enable SSH login for user `pi` in case something will go wrong or just skip to the next step.
|
||||
```
|
||||
cd ~/embassy-os
|
||||
sed -e '/passwd -l pi/ s/^#*/#/' -i setup.sh
|
||||
```
|
||||
> :warning: Default password for user `pi` is `raspberry`, change it the next you login.
|
||||
1. Build the `embassy.img`
|
||||
```
|
||||
cd ~/embassy-os
|
||||
make
|
||||
|
||||
#Depending from your hadware this can take 1-2h+
|
||||
#Wait for the "DONE!" message and take note of your product_key
|
||||
exit
|
||||
```
|
||||
8. Flash the `embassy.img` to a microSD
|
||||
1. Copy `embassy.img` from the raspi to your PC with scp
|
||||
```
|
||||
scp pi@raspi_IP:~/embassy-os/embassy.img .
|
||||
```
|
||||
1. Connect to raspi again to do `sudo shutdown now`, after a complete shutdown disconnect SSD/NVMe drive
|
||||
1. Flash `embassy.img` to a microSD (do this before flashing to the SSD/NVMe, to be sure it works)
|
||||
|
||||
9. Prepare for initial setup
|
||||
1. Boot raspi using flashed microSD
|
||||
1. After a few minutes, the raspi should reboot itself and make it's first [sounds](#embassy-sounds-explained).
|
||||
> :information_source: If needed, you can check the `agent` log with: `journalctl -u agent -ef`
|
||||
1. Proceed with the [initial setup process of EmbassyOS](https://docs.start9labs.com/user-manual/initial-setup.html)
|
||||
1. If all went well you can safely flash `embassy.img` to an SSD/NVMe and repeat step 9
|
||||
|
||||
### Embassy sounds explained
|
||||
Sound :notes: | Indicating
|
||||
------- | --------
|
||||
Bep | Device is powering on
|
||||
Chime | Device is ready for setup
|
||||
Mario "Coin" | EmbassyOS has started
|
||||
Mario "Death" | Device is about to Shutdown/Reboot
|
||||
Mario "Power Up" | EmbassyOS update sequence
|
||||
Beethoven | Update failed :(
|
||||
@@ -77,7 +77,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform
|
||||
|
||||
- Make sure that you are using the latest version.
|
||||
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://docs.start9labs.com). If you are looking for support, you might want to check [this section](#i-have-a-question)).
|
||||
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/Start9Labs/embassy-osissues?q=label%3Abug).
|
||||
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/Start9Labs/embassy-os/issues?q=label%3Abug).
|
||||
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
|
||||
- Collect information about the bug:
|
||||
- Stack trace (Traceback)
|
||||
@@ -225,9 +225,9 @@ When a pull request conflicts with the target branch, you may be asked to rebase
|
||||
This project aims to have a clean git history, where code changes are only made in non-merge commits. This simplifies auditability because merge commits can be assumed to not contain arbitrary code changes.
|
||||
|
||||
## Join The Discussion
|
||||
Current or aspiring contributors? Join our community developer Matrix channel: `#community-dev:matrix.start9labs.com`.
|
||||
Current or aspiring contributors? Join our community developer [Matrix channel](https://matrix.to/#/#community-dev:matrix.start9labs.com).
|
||||
|
||||
Just interested in or using the project? Join our community [Telegram](https://t.me/start9_labs) or Matrix channel: `#community:matrix.start9labs.com`.
|
||||
Just interested in or using the project? Join our community [Telegram](https://t.me/start9_labs) or [Matrix](https://matrix.to/#/#community:matrix.start9labs.com).
|
||||
|
||||
## Join The Project Team
|
||||
Interested in becoming a part of the Start9 Labs team? Send an email to <jobs@start9labs.com>
|
||||
|
||||
34
Makefile
34
Makefile
@@ -1,3 +1,15 @@
|
||||
UNAME := $(shell uname -m)
|
||||
|
||||
EMBASSY_SRC := buster.img product_key appmgr/target/armv7-unknown-linux-gnueabihf/release/appmgr ui/www agent/dist/agent agent/config/agent.service lifeline/target/armv7-unknown-linux-gnueabihf/release/lifeline lifeline/lifeline.service setup.sh setup.service docker-daemon.json
|
||||
APPMGR_RELEASE_SRC := appmgr/target/armv7-unknown-linux-gnueabihf/release/appmgr
|
||||
LIFELINE_RELEASE_SRC := lifeline/target/armv7-unknown-linux-gnueabihf/release/lifeline
|
||||
|
||||
ifeq ($(UNAME), armv7l)
|
||||
EMBASSY_SRC := buster.img product_key appmgr/target/release/appmgr ui/www agent/dist/agent agent/config/agent.service lifeline/target/release/lifeline lifeline/lifeline.service setup.sh setup.service docker-daemon.json
|
||||
APPMGR_RELEASE_SRC := appmgr/target/release/appmgr
|
||||
LIFELINE_RELEASE_SRC := lifeline/target/release/lifeline
|
||||
endif
|
||||
|
||||
APPMGR_SRC := $(shell find appmgr/src) appmgr/Cargo.toml appmgr/Cargo.lock
|
||||
LIFELINE_SRC := $(shell find lifeline/src) lifeline/Cargo.toml lifeline/Cargo.lock
|
||||
AGENT_SRC := $(shell find agent/src) $(shell find agent/config) agent/stack.yaml agent/package.yaml agent/build.sh
|
||||
@@ -13,7 +25,8 @@ UI_SRC := $(shell find ui/src) \
|
||||
|
||||
all: embassy.img
|
||||
|
||||
embassy.img: buster.img product_key appmgr/target/armv7-unknown-linux-gnueabihf/release/appmgr ui/www agent/dist/agent agent/config/agent.service lifeline/target/armv7-unknown-linux-gnueabihf/release/lifeline lifeline/lifeline.service setup.sh setup.service docker-daemon.json
|
||||
embassy.img: $(EMBASSY_SRC)
|
||||
chmod +x make_image.sh
|
||||
sudo ./make_image.sh
|
||||
|
||||
buster.img:
|
||||
@@ -26,11 +39,16 @@ product_key:
|
||||
echo "X\c" > product_key
|
||||
cat /dev/random | base32 | head -c11 | tr '[:upper:]' '[:lower:]' >> product_key
|
||||
|
||||
appmgr/target/armv7-unknown-linux-gnueabihf/release/appmgr: $(APPMGR_SRC)
|
||||
$(APPMGR_RELEASE_SRC): $(APPMGR_SRC)
|
||||
ifeq ($(UNAME), armv7l)
|
||||
cd appmgr && cargo update && cargo build --release --features=production
|
||||
arm-linux-gnueabihf-strip appmgr/target/release/appmgr
|
||||
else
|
||||
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)":/home/rust/src start9/rust-arm-cross:latest sh -c "(cd appmgr && cargo build --release --features=production)"
|
||||
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)":/home/rust/src start9/rust-arm-cross:latest arm-linux-gnueabi-strip appmgr/target/armv7-unknown-linux-gnueabihf/release/appmgr
|
||||
endif
|
||||
|
||||
appmgr: appmgr/target/armv7-unknown-linux-gnueabihf/release/appmgr
|
||||
appmgr: $(APPMGR_RELEASE_SRC)
|
||||
|
||||
agent/dist/agent: $(AGENT_SRC)
|
||||
(cd agent && ./build.sh)
|
||||
@@ -45,9 +63,13 @@ ui/www: $(UI_SRC) ui/node_modules
|
||||
|
||||
ui: ui/www
|
||||
|
||||
lifeline/target/armv7-unknown-linux-gnueabihf/release/lifeline: $(LIFELINE_SRC)
|
||||
$(LIFELINE_RELEASE_SRC): $(LIFELINE_SRC)
|
||||
ifeq ($(UNAME), armv7l)
|
||||
cd lifeline && cargo build --release
|
||||
arm-linux-gnueabihf-strip lifeline/target/release/lifeline
|
||||
else
|
||||
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)":/home/rust/src start9/rust-arm-cross:latest sh -c "(cd lifeline && cargo build --release)"
|
||||
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)":/home/rust/src start9/rust-arm-cross:latest arm-linux-gnueabi-strip lifeline/target/armv7-unknown-linux-gnueabihf/release/lifeline
|
||||
endif
|
||||
|
||||
lifeline: lifeline/target/armv7-unknown-linux-gnueabihf/release/lifeline
|
||||
|
||||
lifeline: $(LIFELINE_RELEASE_SRC)
|
||||
|
||||
16
README.md
16
README.md
@@ -1,28 +1,30 @@
|
||||
# EmbassyOS
|
||||
[](https://github.com/Start9Labs/embassy-os/releases)
|
||||
[](https://matrix.to/#/#community:matrix.start9labs.com)
|
||||
[](https://t.me/start9_labs)
|
||||
[](https://docs.start9labs.com)
|
||||
[](https://matrix.to/#/#community-dev:matrix.start9labs.com)
|
||||
[](https://start9labs.com)
|
||||
[](https://start9labs.com)
|
||||
|
||||
[](http://mastodon.start9labs.com)
|
||||
[](https://twitter.com/start9labs)
|
||||
|
||||
### _Anyone can do it. No one can stop it._ ###
|
||||
|
||||
EmbassyOS is a mass-market, graphical operating system designed to facilitate the discovery, installation, configuration, private self-hosting, and reliable operation of open-source software services and applications. It aims to eliminate trust and custodianship from personal computing.
|
||||
|
||||

|
||||
<img src="eos.png" width="100%">
|
||||
|
||||
## ⚠️ Caution
|
||||
## :warning: Caution
|
||||
Some technologies supported by this software, such as [Lightning](https://lightning.network/), are considered in active development and might experience issues. Do not commit any funds you are not willing to loose. Be #reckless at your own risk.
|
||||
|
||||
## Running EmbassyOS
|
||||
There are multiple ways to obtain and begin using EmbassyOS.
|
||||
|
||||
### Buy an Embassy
|
||||
### :moneybag: Buy an Embassy
|
||||
This is the most convenient option. Simply [buy an Embassy](https://start9labs.com) from Start9 Labs and plug it in. Depending on where you live, shipping costs and import duties may vary.
|
||||
|
||||
### Build your own Embassy
|
||||
### :hammer_and_wrench: Build your own Embassy
|
||||
While not as convenient as buying an Embassy, this option is easier than you might imagine, and there are 4 reasons why you might prefer it:
|
||||
1. You already have a Raspberry Pi and would like to re-purpose it.
|
||||
1. You want to save on shipping costs.
|
||||
@@ -31,5 +33,5 @@ While not as convenient as buying an Embassy, this option is easier than you mig
|
||||
|
||||
To pursue this option, follow this [guide](https://docs.start9labs.com/getting-started/diy.html).
|
||||
|
||||
## Contributing
|
||||
To build EmbassyOS from source, or to contribute to its development, see [here](https://github.com/Start9Labs/embassy-os/blob/master/CONTRIBUTING.md#building-the-image).
|
||||
## :heart: Contributing
|
||||
To build EmbassyOS from source, or to contribute to its development, see [here](https://github.com/Start9Labs/embassy-os/blob/master/CONTRIBUTING.md#building-the-image).
|
||||
|
||||
@@ -33,5 +33,5 @@ database:
|
||||
database: "start9_agent.sqlite3"
|
||||
poolsize: "_env:YESOD_SQLITE_POOLSIZE:10"
|
||||
|
||||
app-mgr-version-spec: "=0.2.11"
|
||||
app-mgr-version-spec: "=0.2.12"
|
||||
#analytics: UA-YOURCODE
|
||||
|
||||
1
agent/migrations/0.2.11::0.2.12
Normal file
1
agent/migrations/0.2.11::0.2.12
Normal file
@@ -0,0 +1 @@
|
||||
SELECT TRUE;
|
||||
@@ -1,5 +1,5 @@
|
||||
name: ambassador-agent
|
||||
version: 0.2.11
|
||||
version: 0.2.12
|
||||
|
||||
default-extensions:
|
||||
- NoImplicitPrelude
|
||||
|
||||
@@ -98,12 +98,12 @@ parseKernelVersion = do
|
||||
pure $ KernelVersion (Version (major', minor', patch', 0)) arch
|
||||
|
||||
synchronizer :: Synchronizer
|
||||
synchronizer = sync_0_2_11
|
||||
synchronizer = sync_0_2_12
|
||||
{-# INLINE synchronizer #-}
|
||||
|
||||
sync_0_2_11 :: Synchronizer
|
||||
sync_0_2_11 = Synchronizer
|
||||
"0.2.11"
|
||||
sync_0_2_12 :: Synchronizer
|
||||
sync_0_2_12 = Synchronizer
|
||||
"0.2.12"
|
||||
[ syncCreateAgentTmp
|
||||
, syncCreateSshDir
|
||||
, syncRemoveAvahiSystemdDependency
|
||||
|
||||
2
appmgr/Cargo.lock
generated
2
appmgr/Cargo.lock
generated
@@ -41,7 +41,7 @@ checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
|
||||
|
||||
[[package]]
|
||||
name = "appmgr"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"avahi-sys",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
authors = ["Aiden McClelland <me@drbonez.dev>"]
|
||||
edition = "2018"
|
||||
name = "appmgr"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
|
||||
[lib]
|
||||
name = "appmgrlib"
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
map $http_x_forwarded_proto $real_proto {{
|
||||
ext+onions ext+onions;
|
||||
ext+onion ext+onion;
|
||||
https https;
|
||||
http http;
|
||||
default $scheme;
|
||||
}}
|
||||
server {{
|
||||
listen 443 ssl;
|
||||
server_name {hostname}.local;
|
||||
@@ -8,8 +15,10 @@ server {{
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $real_proto;
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
proxy_buffering off;
|
||||
}}
|
||||
}}
|
||||
server {{
|
||||
|
||||
@@ -5,5 +5,7 @@ server {{
|
||||
proxy_pass http://{app_ip}:{internal_port}/;
|
||||
proxy_set_header Host $host;
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
proxy_buffering off;
|
||||
}}
|
||||
}}
|
||||
|
||||
@@ -28,8 +28,9 @@ mod v0_2_9;
|
||||
|
||||
mod v0_2_10;
|
||||
mod v0_2_11;
|
||||
mod v0_2_12;
|
||||
|
||||
pub use v0_2_11::Version as Current;
|
||||
pub use v0_2_12::Version as Current;
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[serde(untagged)]
|
||||
@@ -53,6 +54,7 @@ enum Version {
|
||||
V0_2_9(Wrapper<v0_2_9::Version>),
|
||||
V0_2_10(Wrapper<v0_2_10::Version>),
|
||||
V0_2_11(Wrapper<v0_2_11::Version>),
|
||||
V0_2_12(Wrapper<v0_2_12::Version>),
|
||||
Other(emver::Version),
|
||||
}
|
||||
|
||||
@@ -166,6 +168,7 @@ pub async fn init() -> Result<(), failure::Error> {
|
||||
Version::V0_2_9(v) => v.0.migrate_to(&Current::new()).await?,
|
||||
Version::V0_2_10(v) => v.0.migrate_to(&Current::new()).await?,
|
||||
Version::V0_2_11(v) => v.0.migrate_to(&Current::new()).await?,
|
||||
Version::V0_2_12(v) => v.0.migrate_to(&Current::new()).await?,
|
||||
Version::Other(_) => (),
|
||||
// TODO find some way to automate this?
|
||||
}
|
||||
@@ -258,6 +261,7 @@ pub async fn self_update(requirement: emver::VersionRange) -> Result<(), Error>
|
||||
Version::V0_2_9(v) => Current::new().migrate_to(&v.0).await?,
|
||||
Version::V0_2_10(v) => Current::new().migrate_to(&v.0).await?,
|
||||
Version::V0_2_11(v) => Current::new().migrate_to(&v.0).await?,
|
||||
Version::V0_2_12(v) => Current::new().migrate_to(&v.0).await?,
|
||||
Version::Other(_) => (),
|
||||
// TODO find some way to automate this?
|
||||
};
|
||||
|
||||
38
appmgr/src/version/v0_2_12.rs
Normal file
38
appmgr/src/version/v0_2_12.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
use super::*;
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
|
||||
const V0_2_12: emver::Version = emver::Version::new(0, 2, 12, 0);
|
||||
|
||||
pub struct Version;
|
||||
#[async_trait]
|
||||
impl VersionT for Version {
|
||||
type Previous = v0_2_11::Version;
|
||||
fn new() -> Self {
|
||||
Version
|
||||
}
|
||||
fn semver(&self) -> &'static emver::Version {
|
||||
&V0_2_12
|
||||
}
|
||||
async fn up(&self) -> Result<(), Error> {
|
||||
crate::tor::write_lan_services(
|
||||
&crate::tor::services_map(&PersistencePath::from_ref(crate::SERVICES_YAML)).await?,
|
||||
)
|
||||
.await?;
|
||||
let svc_exit = std::process::Command::new("service")
|
||||
.args(&["nginx", "reload"])
|
||||
.status()?;
|
||||
crate::ensure_code!(
|
||||
svc_exit.success(),
|
||||
crate::error::GENERAL_ERROR,
|
||||
"Failed to Reload Nginx: {}",
|
||||
svc_exit
|
||||
.code()
|
||||
.or_else(|| { svc_exit.signal().map(|a| 128 + a) })
|
||||
.unwrap_or(0)
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
async fn down(&self) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
arch=$(uname -m)
|
||||
if [[ $arch == armv7l ]]; then
|
||||
dev_target="target"
|
||||
else
|
||||
dev_target="target/armv7-unknown-linux-musleabihf"
|
||||
fi
|
||||
mv buster.img embassy.img
|
||||
product_key=$(cat product_key)
|
||||
loopdev=$(losetup -f -P embassy.img --show)
|
||||
@@ -9,6 +14,12 @@ mkdir -p "${root_mountpoint}"
|
||||
mkdir -p "${boot_mountpoint}"
|
||||
mount "${loopdev}p2" "${root_mountpoint}"
|
||||
mount "${loopdev}p1" "${boot_mountpoint}"
|
||||
mkdir -p "${root_mountpoint}/root/agent"
|
||||
mkdir -p "${root_mountpoint}/etc/docker"
|
||||
mkdir -p "${root_mountpoint}/home/pi/.ssh"
|
||||
echo -n "" > "${root_mountpoint}/home/pi/.ssh/authorized_keys"
|
||||
chown -R pi:pi "${root_mountpoint}/home/pi/.ssh"
|
||||
echo -n "" > "${boot_mountpoint}/ssh"
|
||||
echo "${product_key}" > "${root_mountpoint}/root/agent/product_key"
|
||||
echo -n "start9-" > "${root_mountpoint}/etc/hostname"
|
||||
echo -n "${product_key}" | shasum -t -a 256 | cut -c1-8 >> "${root_mountpoint}/etc/hostname"
|
||||
@@ -18,20 +29,23 @@ echo -n "${product_key}" | shasum -t -a 256 | cut -c1-8 >> "${root_mountpoint}/e
|
||||
mv "${root_mountpoint}/etc/hosts.tmp" "${root_mountpoint}/etc/hosts"
|
||||
cp agent/dist/agent "${root_mountpoint}/usr/local/bin/agent"
|
||||
chmod 700 "${root_mountpoint}/usr/local/bin/agent"
|
||||
cp appmgr/target/armv7-unknown-linux-musleabihf/release/appmgr "${root_mountpoint}/usr/local/bin/appmgr"
|
||||
cp "appmgr/${dev_target}/release/appmgr" "${root_mountpoint}/usr/local/bin/appmgr"
|
||||
chmod 700 "${root_mountpoint}/usr/local/bin/appmgr"
|
||||
cp lifeline/target/armv7-unknown-linux-musleabihf/release/lifeline "${root_mountpoint}/usr/local/bin/lifeline"
|
||||
cp "lifeline/${dev_target}/release/lifeline" "${root_mountpoint}/usr/local/bin/lifeline"
|
||||
chmod 700 "${root_mountpoint}/usr/local/bin/lifeline"
|
||||
cp docker-daemon.json "${root_mountpoint}/etc/docker/daemon.json"
|
||||
cp setup.sh "${root_mountpoint}/root/setup.sh"
|
||||
chmod 700 "${root_mountpoint}/root/setup.sh"
|
||||
cp setup.service /etc/systemd/system/setup.service
|
||||
cp lifeline/lifeline.service /etc/systemd/system/lifeline.service
|
||||
cp agent/config/agent.service /etc/systemd/system/agent.service
|
||||
cat "${boot_mountpoint}/config.txt" | grep -v "dtoverlay=pwm-2chan" > "${boot_mountpoint}/config.txt.tmp"
|
||||
cp setup.service "${root_mountpoint}/etc/systemd/system/setup.service"
|
||||
ln -s /etc/systemd/system/setup.service "${root_mountpoint}/etc/systemd/system/getty.target.wants/setup.service"
|
||||
cp lifeline/lifeline.service "${root_mountpoint}/etc/systemd/system/lifeline.service"
|
||||
cp agent/config/agent.service "${root_mountpoint}/etc/systemd/system/agent.service"
|
||||
cat "${boot_mountpoint}/config.txt" | grep -v "dtoverlay=" > "${boot_mountpoint}/config.txt.tmp"
|
||||
echo "dtoverlay=pwm-2chan" >> "${boot_mountpoint}/config.txt.tmp"
|
||||
mv "${boot_mountpoint}/config.txt.tmp" "${boot_mountpoint}/config.txt"
|
||||
umount "${root_mountpoint}"
|
||||
rm -r "${root_mountpoint}"
|
||||
umount "${boot_mountpoint}"
|
||||
rm -r "${boot_mountpoint}"
|
||||
losetup -d ${loopdev}
|
||||
losetup -d ${loopdev}
|
||||
echo "DONE! Here is your EmbassyOS key: ${product_key}"
|
||||
@@ -1,10 +1,15 @@
|
||||
[Unit]
|
||||
Description=Boot process for system setup.
|
||||
After=rc-local.service
|
||||
Before=getty.target
|
||||
ConditionFileNotEmpty=/root/setup.sh
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/root/setup.sh
|
||||
ExecStartPost=/root/setup-s2.sh
|
||||
RemainAfterExit=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=basic.target
|
||||
|
||||
|
||||
32
setup.sh
32
setup.sh
@@ -1,15 +1,26 @@
|
||||
#!/bin/bash
|
||||
apt update
|
||||
apt install -y libsecp256k1-0
|
||||
apt install -y tor
|
||||
apt install -y docker.io
|
||||
apt install -y iotop
|
||||
apt install -y bmon
|
||||
apt autoremove -y
|
||||
mkdir -p /root/volumes
|
||||
mkdir -p /root/tmp/appmgr
|
||||
mkdir -p /root/agent
|
||||
mkdir -p /root/appmgr/tor
|
||||
apt-get update -y
|
||||
apt-get install -y tor
|
||||
apt-get install -y iotop
|
||||
apt-get install -y bmon
|
||||
apt-get install -y libavahi-client3
|
||||
apt-get install -y libsecp256k1-0
|
||||
apt-get install -y docker.io needrestart-
|
||||
mv /root/setup.sh /root/setup-s1.sh.done
|
||||
cat <<EOT >> /root/setup-s2.sh
|
||||
#!/bin/bash
|
||||
apt-get update -y
|
||||
apt-get install -y tor
|
||||
apt-get install -y iotop
|
||||
apt-get install -y bmon
|
||||
apt-get install -y libavahi-client3
|
||||
apt-get install -y libsecp256k1-0
|
||||
apt-get install -y docker.io needrestart-
|
||||
apt-get autoremove -y
|
||||
systemctl enable lifeline
|
||||
systemctl enable agent
|
||||
systemctl enable ssh
|
||||
@@ -17,5 +28,8 @@ systemctl enable avahi-daemon
|
||||
passwd -l root
|
||||
passwd -l pi
|
||||
sync
|
||||
systemctl disable setup.service
|
||||
reboot
|
||||
systemctl disable setup
|
||||
mv /root/setup-s2.sh /root/setup-s2.sh.done
|
||||
reboot
|
||||
EOT
|
||||
chmod +x /root/setup-s2.sh
|
||||
@@ -1,6 +1,6 @@
|
||||
manifest-version: 0
|
||||
app-id: start9-ambassador
|
||||
app-version: 0.2.11
|
||||
app-version: 0.2.12
|
||||
uri-rewrites:
|
||||
- =/api -> http://{{start9-ambassador}}:5959/authenticate
|
||||
- /api/ -> http://{{start9-ambassador}}:5959/
|
||||
|
||||
16014
ui/package-lock.json
generated
16014
ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "embassy-ui",
|
||||
"version": "0.2.11",
|
||||
"version": "0.2.12",
|
||||
"description": "GUI for EmbassyOS",
|
||||
"author": "Start9 Labs",
|
||||
"homepage": "https://github.com/Start9Labs/embassy-ui",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title >
|
||||
<ion-label style="font-size: 20px;" class="ion-text-wrap">Welcome to 0.2.11!</ion-label>
|
||||
<ion-label style="font-size: 20px;" class="ion-text-wrap">Welcome to 0.2.12!</ion-label>
|
||||
</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
@@ -12,6 +12,8 @@
|
||||
<div class="main-content">
|
||||
<p>This release includes several bugfixes to resolve:</p>
|
||||
<ol>
|
||||
<li>Faster file upload/download ability</li>
|
||||
<li>More robust support for .local addresses</li>
|
||||
<li>Refreshing error messages during configuration changes</li>
|
||||
<li>Starting services with uninstalled optional dependencies</li>
|
||||
<li>Uninstalling services with optional dependencies</li>
|
||||
|
||||
@@ -59,20 +59,23 @@ export class AppActionsPage extends Cleanup {
|
||||
})
|
||||
await alert.present()
|
||||
} else {
|
||||
const joinStatuses = (statuses: AppStatus[]) => {
|
||||
const last = statuses.pop()
|
||||
let s = statuses.join(', ')
|
||||
if (last) {
|
||||
if (statuses.length > 1) { // oxford comma
|
||||
s += ','
|
||||
}
|
||||
s += ` or ${last}`
|
||||
const statuses = [...action.allowedStatuses]
|
||||
const last = statuses.pop()
|
||||
let statusesStr = statuses.join(', ')
|
||||
let error = null
|
||||
if (statuses.length) {
|
||||
if (statuses.length > 1) { // oxford comma
|
||||
statusesStr += ','
|
||||
}
|
||||
return s
|
||||
statusesStr += ` or ${last}`
|
||||
} else if (last) {
|
||||
statusesStr = `${last}`
|
||||
} else {
|
||||
error = `There is state for which this action may be run. This is a bug. Please file an issue with the service maintainer.`
|
||||
}
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'Forbidden',
|
||||
message: `Action "${action.name}" can only be executed when service is ${joinStatuses(action.allowedStatuses)}`,
|
||||
message: error || `Action "${action.name}" can only be executed when service is ${statusesStr}`,
|
||||
buttons: ['OK'],
|
||||
cssClass: 'alert-error-message',
|
||||
})
|
||||
|
||||
@@ -492,8 +492,8 @@ const mockApiNotifications: ReqRes.GetNotificationsRes = [
|
||||
const mockApiServer: () => ReqRes.GetServerRes = () => ({
|
||||
serverId: 'start9-mockxyzab',
|
||||
name: 'Embassy:12345678',
|
||||
versionInstalled: '0.2.11',
|
||||
versionLatest: '0.2.12',
|
||||
versionInstalled: '0.2.12',
|
||||
versionLatest: '0.2.13',
|
||||
status: ServerStatus.RUNNING,
|
||||
alternativeRegistryUrl: 'beta-registry.start9labs.com',
|
||||
welcomeAck: true,
|
||||
|
||||
@@ -66,6 +66,7 @@ export const bitcoinI: ApiAppInstalledFull = {
|
||||
restoreAlert: 'if you restore this app horrible things will happen to the people you love.',
|
||||
actions: [
|
||||
{ id: 'sync-chain', name: 'Sync Chain', description: 'this will sync with the chain like from Avatar', allowedStatuses: [ AppStatus.RUNNING, AppStatus.RUNNING, AppStatus.RUNNING, AppStatus.RUNNING ]},
|
||||
{ id: 'single-status-action', name: 'Single Status Action', description: 'This action has only one allowed status', allowedStatuses: [ AppStatus.RUNNING ]},
|
||||
{ id: 'off-sync-chain', name: 'Off Sync Chain', description: 'this will off sync with the chain like from Avatar', allowedStatuses: [ AppStatus.STOPPED ]}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"useMocks": false,
|
||||
"mockOver": "tor",
|
||||
"skipStartupAlerts": false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user