Skip to content

Commit

Permalink
Initial Release (#2)
Browse files Browse the repository at this point in the history
* refactored for x86_64 architecture

* updated to v0.1.4

* bugfixes

Co-authored-by: islandbitcoin <[email protected]>
  • Loading branch information
islandbitcoin and islandbitcoin authored Dec 22, 2022
1 parent 51b273b commit a2858ff
Show file tree
Hide file tree
Showing 23 changed files with 114 additions and 874 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jam.s9pk
image.tar
scripts/*.js
scripts/*.js
docker-images/
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "jam-docker"]
path = jam-docker
url = https://github.com/joinmarket-webui/jam-docker.git
37 changes: 11 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
FROM ghcr.io/joinmarket-webui/jam-standalone:latest
RUN apt-get update && apt-get install -qq --no-install-recommends wget bash
RUN wget https://github.com/mikefarah/yq/releases/download/v4.12.2/yq_linux_arm.tar.gz -O - |\
tar xz && mv yq_linux_arm /usr/bin/yq
FROM ghcr.io/joinmarket-webui/jam-standalone:v0.1.4-clientserver-v0.9.8

USER root
# 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 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

ENV DATADIR /root/.joinmarket
ENV CONFIG ${DATADIR}/joinmarket.cfg
ENV DEFAULT_CONFIG /default.cfg
ENV JM_RPC_HOST="bitcoind.embassy"
ENV JM_RPC_PORT="8332"
ENV JM_RPC_USER="bitcoin"
ENV JM_RPC_PASSWORD=
ENV APP_USER "joinmarket"
ENV APP_PASSWORD "joinmarket"
ENV ENSURE_WALLET true
ENV JM_NETWORK mainnet

ENV REMOVE_LOCK_FILES true
ENV RESTORE_DEFAULT_CONFIG true

ADD jam-docker/standalone/nginx/ /nginx/
ADD jam-docker/standalone/default.cfg /
ADD jam-docker/standalone/torrc /

RUN chmod a+x /default.cfg
RUN chmod a+x /torrc

ADD docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
ADD assets/utils/check-web.sh /usr/local/bin/check-web.sh
ADD assets/utils/check-api.sh /usr/local/bin/check-api.sh
ADD actions/unlock-wallet.sh /usr/local/bin/unlock-wallet.sh
RUN chmod a+x /usr/local/bin/*.sh

EXPOSE 80 28183 27183 8080

ENTRYPOINT ["/usr/local/bin/docker_entrypoint.sh"]
36 changes: 21 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
ASSETS := $(shell yq e '.assets.[].src' manifest.yaml)
ASSET_PATHS := $(addprefix assets/,$(ASSETS))
VERSION := $(shell yq e ".version" manifest.yaml)
S9PK_PATH=$(shell find . -name jam.s9pk -print)
PKG_ID := $(shell yq e ".id" manifest.yaml)
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
TS_FILES := $(shell find ./ -name \*.ts)

# 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: jam.s9pk $(S9PK_PATH)
embassy-sdk verify s9pk $(S9PK_PATH)
verify: $(PKG_ID).s9pk
embassy-sdk verify s9pk $(PKG_ID).s9pk

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

clean:
rm -f jam.s9pk
rm -rf docker-images
rm -f image.tar
rm -f $(PKG_ID).s9pk
rm -f scripts/*.js

jam.s9pk: manifest.yaml assets/compat/* image.tar scripts/embassy.js docs/instructions.md $(ASSET_PATHS)
embassy-sdk pack
scripts/embassy.js: $(TS_FILES)
deno bundle scripts/embassy.ts scripts/embassy.js

image.tar: Dockerfile docker_entrypoint.sh assets/utils/*
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --tag start9/jam/main:$(VERSION) --platform=linux/arm64 -o type=docker,dest=image.tar .
docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh assets/utils/*
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/amd64 --build-arg PLATFORM=amd64 -o type=docker,dest=docker-images/x86_64.tar .

scripts/embassy.js: scripts/**/*.ts
deno bundle scripts/embassy.ts scripts/embassy.js
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
if ! [ -z "$(ARCH)" ]; then cp docker-images/$(ARCH).tar image.tar; fi
embassy-sdk pack
24 changes: 0 additions & 24 deletions actions/unlock-wallet.sh

This file was deleted.

6 changes: 0 additions & 6 deletions assets/compat/bitcoind_config_rules.yaml

This file was deleted.

85 changes: 0 additions & 85 deletions assets/compat/btc-rpc-proxy_config_rules.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions assets/compat/config_rules.yaml

This file was deleted.

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

This file was deleted.

6 changes: 3 additions & 3 deletions assets/utils/check-api.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

DURATION=$(</dev/stdin)
if (($DURATION <= 8000)); then
if (($DURATION <= 5000)); then
echo "JAM Web API may take a while to start, please be patient..."
exit 60
else
if ! curl -sSL --silent --fail --insecure https://jam.embassy:28183/api/v1/session &>/dev/null; then
if ! curl -SL --silent --fail --insecure --max-time 10 https://jam.embassy:28183/api/v1/session 2>/dev/null; then
echo "JAM API is unreachable" >&2
exit 1
exit 61
fi
fi
12 changes: 0 additions & 12 deletions assets/utils/check-web.sh

This file was deleted.

Loading

0 comments on commit a2858ff

Please sign in to comment.