Skip to content

Commit

Permalink
Update upstream to v016, fix backups
Browse files Browse the repository at this point in the history
  • Loading branch information
gStart9 committed Oct 18, 2023
1 parent d2635cf commit 0b01381
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 110 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM ghcr.io/joinmarket-webui/jam-standalone:v0.1.5-clientserver-v0.9.9
FROM ghcr.io/joinmarket-webui/jam-standalone:v0.1.6-clientserver-v0.9.10

# arm64 or amd64
ARG PLATFORM
# aarch64 or x86_64
ARG ARCH

RUN apt-get update && apt-get install -qq --no-install-recommends wget bash tini
RUN sed -i "s|http://|https://|g" /etc/apt/sources.list /etc/apt/sources.list.d/*
RUN apt-get update && apt-get -y upgrade && apt-get install -y -qq --no-install-recommends wget bash tini
RUN apt-get upgrade
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${PLATFORM} && chmod +x /usr/local/bin/yq

# USER root
Expand All @@ -15,7 +17,7 @@ ENV APP_PASSWORD "joinmarket"
ENV ENSURE_WALLET true

ENV REMOVE_LOCK_FILES true
ENV RESTORE_DEFAULT_CONFIG true
ENV RESTORE_DEFAULT_CONFIG false

ADD docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
ADD assets/utils/check-api.sh /usr/local/bin/check-api.sh
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
PKG_ID := $(shell yq e ".id" manifest.yaml)
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
TS_FILES := $(shell find ./ -name \*.ts)
ASSET_PATHS := $(shell find ./assets/compat/*)

# delete the target of a rule if it has changed and its recipe exits with a nonzero exit status
.DELETE_ON_ERROR:

all: verify

verify: $(PKG_ID).s9pk
@embassy-sdk verify s9pk $(PKG_ID).s9pk
@start-sdk verify s9pk $(PKG_ID).s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"

install: $(PKG_ID).s9pk
embassy-cli package install $(PKG_ID).s9pk
start-cli package install $(PKG_ID).s9pk

clean:
rm -rf docker-images
Expand All @@ -32,5 +33,5 @@ docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh assets/utils/*
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/arm64 --build-arg PLATFORM=arm64 -o type=docker,dest=docker-images/aarch64.tar .

$(PKG_ID).s9pk: manifest.yaml instructions.md LICENSE icon.png scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar
embassy-sdk pack
$(PKG_ID).s9pk: manifest.yaml instructions.md LICENSE icon.png scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar $(ASSET_PATHS)
start-sdk pack
45 changes: 33 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,78 @@ JAM is a web UI for JoinMarket with focus on user-friendliness. It aims to provi
- [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/)
- [yq](https://mikefarah.gitbook.io/yq)
- [deno](https://deno.land/)
- [embassy-sdk](https://github.com/Start9Labs/embassy-os/tree/master/backend)
- [start-sdk](https://github.com/Start9Labs/start-os/tree/master/backend)
- [make](https://www.gnu.org/software/make/)

## Build enviroment
Prepare your EmbassyOS build enviroment. In this example we are using Ubuntu 20.04.

Prepare your StartOS build enviroment. In this example we are using Ubuntu 20.04.

1. Install docker

```
curl -fsSL https://get.docker.com -o- | bash
sudo usermod -aG docker "$USER"
exec sudo su -l $USER
```

2. Set buildx as the default builder

```
docker buildx install
docker buildx create --use
```

3. Enable cross-arch emulated builds in docker

```
docker run --privileged --rm linuxkit/binfmt:v0.8
```

4. Install yq

```
sudo snap install yq
```

5. Install essentials build packages

```
sudo apt-get install -y build-essential openssl libssl-dev libc6-dev clang libclang-dev ca-certificates
```

6. Install Rust

```
curl https://sh.rustup.rs -sSf | sh
# Choose nr 1 (default install)
source $HOME/.cargo/env
```

7. Install toml

```
cargo install toml-cli
```
8. Build and install embassy-sdk

8. Build and install start-sdk

```
cd ~/ && git clone https://github.com/Start9Labs/embassy-os.git
cd embassy-os/backend/
cd ~/ && git clone https://github.com/Start9Labs/start-os.git
cd start-os/backend/
./install-sdk.sh
```

## Cloning

Clone the project locally. Note the submodule link to the original project(s).
Clone the project locally. Note the submodule link to the original project(s).

```
git clone https://github.com/Start9Labs/jam-wrapper.git
cd jam-wrapper
git submodule update --init --recursive
```

## Building

To build the project, run the following commands:
Expand All @@ -79,19 +96,23 @@ You should only run the above commands once to create a custom builder. Afterwar
make
```

## Installing (on Embassy)
## Installing (on StartOS)

SSH into an Embassy device.
Sideload from the web-UI via:
System > Sideload Service

...or SSH into an StartOS device.
`scp` the `.s9pk` to any directory from your local machine.
Run the following command to install the package:

```
embassy-cli auth login
#Enter your embassy password then run:
embassy-cli package install /path/to/jam.s9pk
start-cli auth login
#Enter your StartOS server's master password, then run:
start-cli package install /path/to/jam.s9pk
```

## Verify Install

Go to your Embassy Services page, select JAM and start the service.
Go to your StartOS Services page, select JAM and start the service.

#Done
36 changes: 36 additions & 0 deletions assets/compat/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
# Multi-path backup script
set -e

if [ "$1" = "create" ]; then
shift
backup_type="create"
elif [ "$1" = "restore" ]; then
shift
backup_type="restore"
else
echo "Usage: $0 [create|restore] [dir1] [dir2] ..."
exit 1
fi

backup_dir="/mnt/backup"

for dir in "$@"; do
if [ ! -d "$dir" ]; then
echo "Error: Directory '$dir' does not exist."
exit 1
fi

target_dir="$backup_dir/$(basename "$dir")"

mkdir -p "$target_dir"

case "$backup_type" in
create)
compat duplicity create "$target_dir" "$dir"
;;
restore)
compat duplicity restore "$target_dir" "$dir"
;;
esac
done
44 changes: 22 additions & 22 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ set -e

# Setting env-vars
echo "Setting environment variables..."
export APP_USER=$(yq e '.username' /embassy/start9/config.yaml)
export APP_PASSWORD=$(yq e '.password' /embassy/start9/config.yaml)
export TOR_HOST=$(yq e '.tor-address' /embassy/start9/config.yaml)
export LAN_HOST=$(yq e '.lan-address' /embassy/start9/config.yaml)
export JM_RPC_USER=$(yq e '.bitcoind-user' /embassy/start9/config.yaml)
export JM_RPC_PASSWORD=$(yq e '.bitcoind-password' /embassy/start9/config.yaml)
export APP_USER=$(yq e '.username' /data/start9/config.yaml)
export APP_PASSWORD=$(yq e '.password' /data/start9/config.yaml)
export TOR_HOST=$(yq e '.tor-address' /data/start9/config.yaml)
export LAN_HOST=$(yq e '.lan-address' /data/start9/config.yaml)
export JM_RPC_USER=$(yq e '.bitcoind-user' /data/start9/config.yaml)
export JM_RPC_PASSWORD=$(yq e '.bitcoind-password' /data/start9/config.yaml)
export JM_RPC_PORT=8332
export JM_RPC_WALLET_FILE="embassy_jam_wallet"
export JM_RPC_HOST="bitcoind.embassy"
echo "Running on Bitcoin Core..."

# Properties Page showing password to be used for login
echo 'version: 2' > /embassy/start9/stats.yaml
echo 'data:' >> /embassy/start9/stats.yaml
echo ' Username: ' >> /embassy/start9/stats.yaml
echo ' type: string' >> /embassy/start9/stats.yaml
echo " value: \"$APP_USER\"" >> /embassy/start9/stats.yaml
echo ' description: This is your username for JAM' >> /embassy/start9/stats.yaml
echo ' copyable: true' >> /embassy/start9/stats.yaml
echo ' masked: false' >> /embassy/start9/stats.yaml
echo ' qr: false' >> /embassy/start9/stats.yaml
echo ' Password: ' >> /embassy/start9/stats.yaml
echo ' type: string' >> /embassy/start9/stats.yaml
echo " value: \"$APP_PASSWORD\"" >> /embassy/start9/stats.yaml
echo ' description: This is your password for JAM. Please use caution when sharing this password, you could lose your funds!' >> /embassy/start9/stats.yaml
echo ' copyable: true' >> /embassy/start9/stats.yaml
echo ' masked: true' >> /embassy/start9/stats.yaml
echo ' qr: false' >> /embassy/start9/stats.yaml
echo 'version: 2' > /data/start9/stats.yaml
echo 'data:' >> /data/start9/stats.yaml
echo ' Username: ' >> /data/start9/stats.yaml
echo ' type: string' >> /data/start9/stats.yaml
echo " value: \"$APP_USER\"" >> /data/start9/stats.yaml
echo ' description: This is your username for JAM' >> /data/start9/stats.yaml
echo ' copyable: true' >> /data/start9/stats.yaml
echo ' masked: false' >> /data/start9/stats.yaml
echo ' qr: false' >> /data/start9/stats.yaml
echo ' Password: ' >> /data/start9/stats.yaml
echo ' type: string' >> /data/start9/stats.yaml
echo " value: \"$APP_PASSWORD\"" >> /data/start9/stats.yaml
echo ' description: This is your password for JAM. Please use caution when sharing this password, you could lose your funds!' >> /data/start9/stats.yaml
echo ' copyable: true' >> /data/start9/stats.yaml
echo ' masked: true' >> /data/start9/stats.yaml
echo ' qr: false' >> /data/start9/stats.yaml

# Starting JoinMarket API
echo "Starting JoinMarket..."
Expand Down
46 changes: 24 additions & 22 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
id: jam
id: jam
title: JAM
version: 0.1.5
version: 0.1.6
release-notes: |
* Update to latest upstream - [JAM v0.1.5 Release Notes](https://github.com/joinmarket-webui/jam/releases/tag/v0.1.5)
* Update to latest upstream - [JAM v0.1.6 Release Notes](https://github.com/joinmarket-webui/jam/releases/tag/v0.1.6)
* Fix backup creation and restore processes.
license: mit
wrapper-repo: "https://github.com/Start9Labs/jam-wrapper"
upstream-repo: "https://github.com/joinmarket-webui/jam-docker"
support-site: "https://github.com/joinmarket-webui/jam-docker/issues"
marketing-site: "https://jamapp.org"
build: ["make"]
description:
short: JAM - A friendly UI for JoinMarket
short: JAM - A friendly UI for JoinMarket
long: |
Jam is a web UI for JoinMarket with focus on user-friendliness.
It aims to provide sensible defaults and be easy to use for beginners while still providing the features advanced users expect.
Expand All @@ -24,7 +25,7 @@ main:
entrypoint: "tini"
args: ["-g", "--", "docker_entrypoint.sh"]
mounts:
main: /embassy
main: /data
jam: /root/.joinmarket
health-checks:
web-ui:
Expand Down Expand Up @@ -52,6 +53,8 @@ volumes:
type: data
jam:
type: data
compat:
type: assets
interfaces:
main:
name: JAM Web UI
Expand All @@ -67,22 +70,22 @@ interfaces:
protocols:
- tcp
- http
dependencies:
dependencies:
bitcoind:
version: ">=0.23.0.1 <=26.0.0"
requirement:
type: required
description: Used to subscribe to new block events from a full archival node.
config:
check:
check:
type: script
auto-configure:
type: script
alerts:
install: |
WARNING: If you have an older version of JAM running, this install will stop all active liquidity offers. You will need to manually restart your offers after the install is complete.
start: |
It may take some time for the JAM API to initialize over the Tor network, please be patient.
It may take some time for the JAM API to initialize over the Tor network, please be patient.
migrations:
from:
"*":
Expand All @@ -96,29 +99,28 @@ backup:
create:
type: docker
image: compat
system: true
entrypoint: compat
args:
- duplicity
system: true
entrypoint: /mnt/assets/backup.sh
args:
- create
- /mnt/backup
- /app/data
- /data/start9
- /root/.joinmarket
mounts:
BACKUP: "/mnt/backup"
main: "/app/data"
BACKUP: "/mnt/backup"
compat: "/mnt/assets"
main: "/data/start9"
jam: "/root/.joinmarket"
restore:
type: docker
image: compat
system: true
entrypoint: compat
entrypoint: /mnt/assets/backup.sh
args:
- duplicity
- restore
- /mnt/backup
- /app/data
- /data/start9
- /root/.joinmarket
mounts:
BACKUP: "/mnt/backup"
main: "/app/data"
compat: "/mnt/assets"
main: "/data/start9"
jam: "/root/.joinmarket"

Loading

0 comments on commit 0b01381

Please sign in to comment.