Skip to content

Commit

Permalink
Update to v0.1.4 (#7)
Browse files Browse the repository at this point in the history
* refactor to use js procedures for config and properties

* add empty migration so no need to reconfigure on update

* convert health check to js

* copy and formatting

* account for case of empty properties
  • Loading branch information
elvece authored Sep 6, 2022
1 parent 5e1db3f commit c9f43c3
Show file tree
Hide file tree
Showing 15 changed files with 314 additions and 170 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
www/.DS_Store
embassy-pages.s9pk
image.tar
test_config.yaml
test_config.yaml
.vscode
scripts/embassy.js
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ RUN cp /var/www/assets/main.css /var/www/index/main.css
RUN cp /var/www/assets/main.css /var/www/welcome/main.css
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod a+x /usr/local/bin/docker_entrypoint.sh
ADD ./check-web.sh /usr/local/bin/check-web.sh
RUN chmod a+x /usr/local/bin/check-web.sh

WORKDIR /root

Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
EMVER := $(shell toml get manifest.toml "version" | sed -e 's/^"//' -e 's/"//')
ASSET_PATHS := $(shell find ./assets/*)
S9PK_PATH=$(shell find . -name embassy-pages.s9pk -print)
SCRIPTS_SRC := $(shell find ./scripts -name '*.ts')

.DELETE_ON_ERROR:

Expand All @@ -16,8 +16,11 @@ clean:
install: embassy-pages.s9pk
embassy-cli package install embassy-pages

embassy-pages.s9pk: manifest.toml image.tar instructions.md LICENSE icon.png ${ASSET_PATHS}
embassy-pages.s9pk: manifest.toml image.tar instructions.md LICENSE icon.png ${ASSET_PATHS} scripts/embassy.js
embassy-sdk pack

image.tar: Dockerfile docker_entrypoint.sh check-web.sh
image.tar: Dockerfile docker_entrypoint.sh
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --tag start9/embassy-pages/main:${EMVER} --platform=linux/arm64/v8 -o type=docker,dest=image.tar .

scripts/embassy.js: $(SCRIPTS_SRC)
deno bundle scripts/embassy.ts scripts/embassy.js
1 change: 0 additions & 1 deletion assets/compat/config_rules.yaml

This file was deleted.

88 changes: 0 additions & 88 deletions assets/compat/config_spec.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions check-web.sh

This file was deleted.

21 changes: 0 additions & 21 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,6 @@ home_type=$(yq e '.homepage.type' start9/config.yaml)
subdomains=($(yq e '.subdomains.[].name' start9/config.yaml))
tor_address=($(yq e '.tor-address' start9/config.yaml))

read -r -d "" build_site_desc <<EOT
{
"description": "Subdomain link for the site " + .,
"masked": false,
"copyable": true,
"qr": false,
"type": "string",
"value": . + ".$tor_address"
}
EOT
yq e ".subdomains.[].name | {.: $build_site_desc}" start9/config.yaml > start9/stats.yaml
yq e -i '{"value": . }' start9/stats.yaml
yq e -i '.type="object"' start9/stats.yaml
yq e -i '.description="The available subdomains."' start9/stats.yaml
yq e -i '{"Subdomains": . }' start9/stats.yaml
yq e -i '{"data": .}' start9/stats.yaml
yq e -i '.version = 2' start9/stats.yaml
if [ ! -s start9/stats.yaml ] ; then
rm start9/stats.yaml
fi

bucket_size=64
for subdomain in "${subdomains[@]}"; do
suffix=".${tor_address}"
Expand Down
58 changes: 17 additions & 41 deletions manifest.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
build = ["make"]
id = "embassy-pages"
license = "mit"
release-notes = "Upgrade to EmbassyOS v0.3.0"
release-notes = "Switch to using new eOS APIs for faster configuration and properties"
support-site = "https://matrix.to/#/!lMnRwPWnyQvOfAoEnD:matrix.start9labs.com"
title = "Embassy Pages"
upstream-repo = "https://github.com/Start9Labs/embassy-pages-wrapper"
version = "0.1.3"
version = "0.1.4"
wrapper-repo = "https://github.com/Start9Labs/embassy-pages-wrapper"

[description]
Expand All @@ -26,52 +26,23 @@ io-format = "yaml"
mounts = { main = "/root", filebrowser = "/mnt/filebrowser" }
type = "docker"

[health-checks.main]
args = []
entrypoint = "check-web.sh"
image = "main"
inject = true
io-format = "json"
["health-checks"."web-ui"]
name = "Web UI"
success-message = "The Web UI is ready to be visited in a web browser"
type = "docker"
success-message = "Ready to be visited in a web browser"
type = "script"

[config.get]
args = ["config", "get", "/root", "/mnt/assets/config_spec.yaml"]
entrypoint = "compat"
image = "compat"
io-format = "yaml"
mounts = { compat = "/mnt/assets", main = "/root" }
system = true
type = "docker"
type = "script"

[config.set]
args = [
"config",
"set",
"embassy-pages",
"/root",
"/mnt/assets/config_rules.yaml",
]
entrypoint = "compat"
image = "compat"
io-format = "yaml"
mounts = { compat = "/mnt/assets", main = "/root" }
system = true
type = "docker"
type = "script"

[properties]
args = ["properties", "/root"]
entrypoint = "compat"
image = "compat"
io-format = "yaml"
mounts = { compat = "/mnt/assets", main = "/root" }
system = true
type = "docker"
type = "script"

[dependencies.filebrowser]
description = "Used to upload files to serve."
version = "^2.14.1.1"
version = "^2.21.1"

[dependencies.filebrowser.requirement]
type = "required"
Expand All @@ -86,9 +57,6 @@ readonly = true
type = "pointer"
volume-id = "main"

[volumes.compat]
type = "assets"

[interfaces.main]
description = "Your Embassy Pages sites are displayed here when visited in a web browser."
name = "Web UI"
Expand All @@ -113,3 +81,11 @@ io-format = "yaml"
mounts = { BACKUP = "/mnt/backup", main = "/root/data" }
system = true
type = "docker"

[migrations.from."*"]
type = "script"
args = [ "from" ]

[migrations.to."*"]
type = "script"
args = [ "to" ]
3 changes: 3 additions & 0 deletions scripts/deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "https://deno.land/x/embassyd_sdk@v0.3.1.1.1/mod.ts";
export * from "https://deno.land/x/embassyd_sdk@v0.3.1.1.1/util.ts";
export * from "https://deno.land/x/embassyd_sdk@v0.3.1.0.12/emvar-lite/mod.ts";
5 changes: 5 additions & 0 deletions scripts/embassy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { properties } from "./procedures/properties.ts";
export { health } from "./procedures/healthChecks.ts";
export { setConfig } from "./procedures/setConfig.ts";
export { getConfig } from "./procedures/getConfig.ts";
export { migration } from "./procedures/migrations.ts";
Loading

0 comments on commit c9f43c3

Please sign in to comment.