-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f200f3d
Showing
23 changed files
with
871 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build Service | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths-ignore: ['*.md'] | ||
branches: ['main', 'master'] | ||
push: | ||
paths-ignore: ['*.md'] | ||
branches: ['main', 'master'] | ||
|
||
jobs: | ||
BuildPackage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Prepare StartOS SDK | ||
uses: Start9Labs/sdk@v1 | ||
|
||
- name: Checkout services repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build the service package | ||
id: build | ||
run: | | ||
git submodule update --init --recursive | ||
start-sdk init | ||
make | ||
PACKAGE_ID=$(yq -oy ".id" manifest.*) | ||
echo "::set-output name=package_id::$PACKAGE_ID" | ||
shell: bash | ||
|
||
- name: Upload .s9pk | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.build.outputs.package_id }}.s9pk | ||
path: ./${{ steps.build.outputs.package_id }}.s9pk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Release Service | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*' | ||
|
||
jobs: | ||
ReleasePackage: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Prepare StartOS SDK | ||
uses: Start9Labs/sdk@v1 | ||
|
||
- name: Checkout services repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build the service package | ||
run: | | ||
git submodule update --init --recursive | ||
start-sdk init | ||
make | ||
- name: Setting package ID and title from the manifest | ||
id: package | ||
run: | | ||
echo "::set-output name=package_id::$(yq -oy ".id" manifest.*)" | ||
echo "::set-output name=package_title::$(yq -oy ".title" manifest.*)" | ||
shell: bash | ||
|
||
- name: Generate sha256 checksum | ||
run: | | ||
PACKAGE_ID=${{ steps.package.outputs.package_id }} | ||
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256 | ||
shell: bash | ||
|
||
- name: Generate changelog | ||
run: | | ||
PACKAGE_ID=${{ steps.package.outputs.package_id }} | ||
echo "## What's Changed" > change-log.txt | ||
yq -oy '.release-notes' manifest.* >> change-log.txt | ||
echo "## SHA256 Hash" >> change-log.txt | ||
echo '```' >> change-log.txt | ||
sha256sum ${PACKAGE_ID}.s9pk >> change-log.txt | ||
echo '```' >> change-log.txt | ||
shell: bash | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
name: ${{ steps.package.outputs.package_title }} ${{ github.ref_name }} | ||
prerelease: true | ||
body_path: change-log.txt | ||
files: | | ||
./${{ steps.package.outputs.package_id }}.s9pk | ||
./${{ steps.package.outputs.package_id }}.s9pk.sha256 | ||
- name: Publish to Registry | ||
env: | ||
S9USER: ${{ secrets.S9USER }} | ||
S9PASS: ${{ secrets.S9PASS }} | ||
S9REGISTRY: ${{ secrets.S9REGISTRY }} | ||
run: | | ||
if [[ -z "$S9USER" || -z "$S9PASS" || -z "$S9REGISTRY" ]]; then | ||
echo "Publish skipped: missing registry credentials." | ||
else | ||
start-sdk publish https://$S9USER:$S9PASS@$S9REGISTRY ${{ steps.package.outputs.package_id }}.s9pk | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
jam.s9pk | ||
image.tar | ||
scripts/*.js | ||
docker-images/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Stage 1: Build gatewayd | ||
FROM fedimint/gatewayd:v0.3.0 AS gatewayd | ||
|
||
# Set environment variables for gatewayd | ||
ENV FM_GATEWAY_DATA_DIR=/gateway_data | ||
ENV FM_GATEWAY_LISTEN_ADDR=0.0.0.0:8175 | ||
ENV FM_GATEWAY_API_ADDR=http://127.0.0.1:8175 | ||
ENV FM_GATEWAY_PASSWORD=thereisnosecondbest | ||
ENV FM_GATEWAY_FEES=0,10000 | ||
ENV FM_LND_RPC_ADDR=https://lnd.embassy:10009 | ||
ENV FM_LND_TLS_CERT=/lnd_data/tls.cert | ||
ENV FM_LND_MACAROON=/lnd_data/data/chain/bitcoin/signet/admin.macaroon | ||
|
||
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh | ||
RUN chmod +x /usr/local/bin/docker_entrypoint.sh | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker_entrypoint.sh"] | ||
|
||
# # Set up volumes for gatewayd | ||
# VOLUME ["/gateway_data"] | ||
|
||
# # Stage 2: Build gateway-ui | ||
# FROM fedimintui/gateway-ui:0.3.0 as gateway-ui | ||
|
||
# # Set environment variables for gateway-ui | ||
# ENV PORT=3001 | ||
# ENV REACT_APP_FM_GATEWAY_API=http://127.0.0.1:8175 | ||
# ENV REACT_APP_FM_GATEWAY_PASSWORD=thereisnosecondbest | ||
|
||
# # Expose ports for gateway-ui | ||
# EXPOSE 3001 | ||
|
||
# # Final stage: Combine both | ||
# FROM fedimint/gatewayd:v0.3.0 | ||
|
||
# # Copy gateway-ui files | ||
# COPY --from=gateway-ui /usr/share/nginx/html /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Start9 Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 | ||
@start-sdk verify s9pk $(PKG_ID).s9pk | ||
@echo " Done!" | ||
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready" | ||
|
||
install: $(PKG_ID).s9pk | ||
start-cli package install $(PKG_ID).s9pk | ||
|
||
clean: | ||
rm -rf docker-images | ||
rm -f image.tar | ||
rm -f $(PKG_ID).s9pk | ||
rm -f scripts/*.js | ||
|
||
scripts/embassy.js: $(TS_FILES) | ||
deno bundle scripts/embassy.ts scripts/embassy.js | ||
|
||
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 . | ||
|
||
# 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 $(ASSET_PATHS) | ||
# start-sdk pack | ||
$(PKG_ID).s9pk: manifest.yaml instructions.md LICENSE icon.png scripts/embassy.js docker-images/x86_64.tar $(ASSET_PATHS) | ||
start-sdk pack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Wrapper for Jam | ||
|
||
[Jam](https://github.com/joinmarket-webui/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. | ||
|
||
## Dependencies | ||
|
||
- [docker](https://docs.docker.com/get-docker) | ||
- [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/) | ||
- [yq](https://mikefarah.gitbook.io/yq) | ||
- [deno](https://deno.land/) | ||
- [start-sdk](https://github.com/Start9Labs/start-os/tree/master/backend) | ||
- [make](https://www.gnu.org/software/make/) | ||
|
||
## Build enviroment | ||
|
||
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 | ||
|
||
Ubuntu: | ||
|
||
``` | ||
sudo snap install yq | ||
``` | ||
|
||
Debian: | ||
|
||
``` | ||
PLATFORM=$(dpkg --print-architecture) | ||
wget -q https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${PLATFORM} && sudo mv yq_linux_${PLATFORM} /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq | ||
``` | ||
|
||
5. Install essential 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 start-sdk | ||
|
||
``` | ||
cd ~/ && git clone https://github.com/Start9Labs/start-os.git | ||
#checkout v0.3.5.1 | ||
git checkout 39de098461833e4c56bd3509644ddf7f1a0fc4ca | ||
cd core/ | ||
./install-sdk.sh | ||
start-sdk init | ||
``` | ||
|
||
## Cloning | ||
|
||
Clone the project locally. Note the submodule link to the original project(s). | ||
|
||
``` | ||
git clone https://github.com/Start9Labs/jam-startos | ||
cd jam-startos | ||
git submodule update --init --recursive | ||
``` | ||
|
||
## Building | ||
|
||
To build the project, run the following commands: | ||
|
||
``` | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
docker buildx create --name multiarch --driver docker-container --use | ||
docker buildx inspect --bootstrap | ||
``` | ||
|
||
You should only run the above commands once to create a custom builder. Afterwards you will only need the below command to make the .s9pk file | ||
|
||
``` | ||
make | ||
``` | ||
|
||
## Installing (on StartOS) | ||
|
||
Sideload from the web-UI: | ||
System > Sideload Service | ||
|
||
Sideload from the CLI: | ||
[SSH](https://docs.start9.com/latest/user-manual/overview/ssh) into your StartOS device. | ||
`scp` the `.s9pk` to any directory from your local machine. | ||
Run the following command to install the package: | ||
|
||
``` | ||
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 StartOS Services page, select Jam and start the service. | ||
|
||
#Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
DURATION=$(</dev/stdin) | ||
if (($DURATION <= 5000)); then | ||
echo "Jam Web API may take a while to start, please be patient..." | ||
exit 60 | ||
else | ||
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 61 | ||
fi | ||
fi |
Oops, something went wrong.