Merge pull request #1 from kn0wmad/next

working version of RoboSats for EmbassyOS
This commit is contained in:
kn0wmad
2022-09-09 13:09:10 -06:00
committed by GitHub
11 changed files with 98 additions and 36 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
hello-world.s9pk
robosats.s9pk
image.tar
scripts/*.js
.DS_Store

View File

@ -1,7 +1,14 @@
FROM start9/hello-world
FROM recksato/robosats-client
RUN apt-get update && apt-get install wget curl sudo bash tini -y \
&& wget https://github.com/mikefarah/yq/releases/download/v4.25.1/yq_linux_arm.tar.gz -O - |\
tar xz && mv yq_linux_arm /usr/bin/yq
RUN apk add --no-cache curl && \
rm -f /var/cache/apk/*
ENV APP_HOST robosats.embassy
ENV APP_PORT 12596
ENV TOR_PROXY_IP embassy
ENV TOR_PROXY_PORT 9050
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/*.sh
RUN chmod a+x *.sh

View File

@ -10,7 +10,7 @@ all: verify
verify: $(PKG_ID).s9pk
embassy-sdk verify s9pk $(PKG_ID).s9pk
install:
install: all
embassy-cli package install $(PKG_ID).s9pk
clean:
@ -24,5 +24,5 @@ scripts/embassy.js: $(TS_FILES)
image.tar: Dockerfile docker_entrypoint.sh
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/arm64 -o type=docker,dest=image.tar .
$(PKG_ID).s9pk: manifest.yaml instructions.md icon.png LICENSE scripts/embassy.js image.tar
$(PKG_ID).s9pk: check-web.sh manifest.yaml instructions.md icon.png LICENSE scripts/embassy.js image.tar
embassy-sdk pack

View File

@ -1,6 +1,6 @@
# Wrapper for hello-world
# Wrapper for RoboSats
`hello-world` is a simple, minimal project to serve as a template for creating an app for the Embassy. Learn more about service packaging in [Developer Docs](https://start9.com/latest/developer-docs/).
RoboSats is a simple and private bitcoin exchange
## Dependencies
@ -54,15 +54,15 @@ cd embassy-os/backend/
./install-sdk.sh
embassy-sdk init
```
Now you are ready to build your **hello-world** service
Now you are ready to build your **robosats** service
## Cloning
Clone the project locally.
```
git clone https://github.com/Start9Labs/hello-world-wrapper.git
cd hello-world-wrapper
git clone https://github.com/Start9Labs/robosats-wrapper.git
cd robosats-wrapper
```
## Building
@ -81,9 +81,9 @@ Run the following commands to determine successful install:
```
embassy-cli auth login
#Enter your embassy password
embassy-cli --host https://embassy-q1w2e3r4.local package install hello-world.s9pk
embassy-cli --host https://embassy-q1w2e3r4.local package install robosats.s9pk
```
**Tip:** You can also install the hello-world.s9pk using **Sideload Service** under the **Embassy > SETTINGS** section.
**Tip:** You can also install the robosats.s9pk using **Sideload Service** under the **Embassy > SETTINGS** section.
## Verify Install
Go to your Embassy Services page, select **Hello World**, configure and start the service.

13
check-web.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
DURATION=$(</dev/stdin)
if (($DURATION <= 5500)); then
exit 60
else
curl --silent --fail robosats.embassy:12596 &>/dev/null
WEB_RES=$?
if [ $WEB_RES != 0 ]; then
echo "RoboSats UI is unreachable, please wait" >&2
exit 61
fi
fi

View File

@ -1,3 +1,6 @@
#!/bin/sh
#!/bin/bash
exec tini hello-world
set -ea
echo "Starting RoboSats..."
exec tini -s ./robosats-client.sh

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -1,4 +1,4 @@
# Instructions for Hello World
# Instructions for RoboSats
Instructions go here. These appear to the user in the UI on the Service page under **Instructions**.

View File

@ -1,32 +1,32 @@
# Example written in yaml (toml and json are also acceptable)
# The package identifier used by the OS. This must be unique amongst all other known packages
id: hello-world
id: robosats
# A human readable service title
title: "Hello World"
title: "RoboSats"
# Service version - accepts up to four digits, where the last confirms to revisions necessary for EmbassyOS - see documentation: https://github.com/Start9Labs/emver-rs. This value will change with each release of the service.
version: 1.0.0.0
version: 0.1.0
# Release notes for the update - can be a string, paragraph or URL
release-notes: "Revamped for EmabssyOS 0.3.2"
release-notes: "Initial Release for EmabssyOS"
# The type of license for the project. Include the LICENSE in the root of the project directory. A license is required for a Start9 package.
license: mit
# The Start9 wrapper repository URL for the package. This repo contains the manifest file (this), any scripts necessary for configuration, backups, actions, or health checks (more below). This key must exist. But could be embedded into the source repository.
wrapper-repo: "https://github.com/Start9Labs/hello-world-wrapper"
wrapper-repo: "https://github.com/Start9Labs/robosats-wrapper"
# The original project repository URL. There is no upstream repo in this example
upstream-repo: "https://github.com/Start9Labs/hello-world"
upstream-repo: "https://github.com/Reckless-Satoshi/robosats"
# URL to the support site / channel for the project. This key can be omitted if none exists, or it can link to the original project repository issues.
support-site: "https://docs.start9.com/"
support-site: "https://github.com/Reckless-Satoshi/robosats/issues"
# URL to the marketing site for the project. This key can be omitted if none exists, or it can link to the original project repository.
marketing-site: "https://start9.com/"
marketing-site: "https://learn.robosats.com/"
# The series of commands to build the project into an s9pk for arm64/v8. In this case we are using a Makefile with the simple build command "make".
build: ["make"]
# Human readable descriptors for the service. These are used throughout the EmbassyOS user interface, primarily in the marketplace.
description:
# This is the first description visible to the user in the marketplace.
short: Example service
short: A simple and private bitcoin exchange
# This description will display with additional details in the service's individual marketplace page
long: |
Hello World is a bare-bones service that launches a web interface to say "Hello World", and nothing more.
RoboSats is a simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. The deterministically generated avatars help users stick to best privacy practices.
# These assets are static files necessary for packaging the service for Start9 (into an s9pk). Each value is a path to the specified asset. If an asset is missing from this list, or otherwise denoted, it will be defaulted to the values denoted below.
assets:
# Default = LICENSE.md
@ -52,8 +52,21 @@ main:
# Specifies where on the service's file system its persistence directory should be mounted prior to service startup
main: /root
# Health checks
health-checks: {}
config: ~
health-checks:
main:
name: Web Interface
success-message: The RoboSats UI is ready to visit in a web browser
type: docker
image: main
entrypoint: check-web.sh
args: []
io-format: json
inject: true
config:
get:
type: script
set:
type: script
properties: ~
# type: script
# This denotes any data, asset, or pointer volumes that should be connected when the "docker run" command is invoked
@ -72,12 +85,8 @@ interfaces:
tor-config:
# Port mappings are from the external port to the internal container port
port-mapping:
80: "80"
80: "12596"
# Port mappings are from the external port to the internal container port
lan-config:
443:
ssl: true
internal: 80
# Denotes if the service has a user interface to display
ui: true
# Denotes the protocol specifications used by this interface
@ -85,6 +94,9 @@ interfaces:
- tcp
- http
dependencies: {}
alerts:
start: |
ATTENTION: You must have a Tor supported browser to use this service.
# Specifies how backups should be run for this service. The default EmbassyOS provided option is to use the duplicity backup library on a system image (compat)
backup:
create:

View File

@ -2,4 +2,31 @@
import { compat, types as T } from "../deps.ts";
export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({});
export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
"tor-address": {
"name": "Tor Address",
"description": "The Tor address of the network interface",
"type": "pointer",
"subtype": "package",
"package-id": "robosats",
"target": "tor-address",
"interface": "main",
},
"lan-address": {
"name": "LAN Address",
"description": "The LAN address of the network interface",
"type": "pointer",
"subtype": "package",
"package-id": "robosats",
"target": "lan-address",
"interface": "main",
},
"rs-hash": {
"type": "string",
"name": "Robosats Unique Hash",
"description": "TBD",
"nullable": true,
"copyable": true,
"masked": false,
}
});

View File

@ -1,4 +1,4 @@
import { compat, types as T } from "../deps.ts";
export const migration: T.ExpectedExports.migration = compat.migrations
.fromMapping({}, "1.0.0.0" );
.fromMapping({}, "0.1.0" );