Skip to content

Commit

Permalink
Update/1.27.3 (#34)
Browse files Browse the repository at this point in the history
* Bump version

* use new SDK

* manifest cleaning and rearrangement

* readme refactor

* Makefile refactor

* Update base image and simplify

* Implement build and release workflows

* Updated Docs and Instructions (#33)

* Fix web ui

* use latest stable sdk

* Use upstream image and fix entrypoint

* cleaning

* Better icon

* fix properties race condition

* use old config path

* Update release notes

* fix changelog link

---------

Co-authored-by: Cryptosquid <[email protected]>
  • Loading branch information
k0gen and The-Cryptosquid authored Feb 19, 2024
1 parent 32e4349 commit e94e461
Show file tree
Hide file tree
Showing 18 changed files with 301 additions and 141 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/buildService.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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 "package_id=$PACKAGE_ID" >> $GITHUB_ENV
shell: bash

- name: Upload .s9pk
uses: actions/upload-artifact@v3
with:
name: ${{ env.package_id }}.s9pk
path: ./${{ env.package_id }}.s9pk
71 changes: 71 additions & 0 deletions .github/workflows/releaseService.yml
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 "package_id=$(yq -oy ".id" manifest.*)" >> $GITHUB_ENV
echo "package_title=$(yq -oy ".title" manifest.*)" >> $GITHUB_ENV
shell: bash

- name: Generate sha256 checksum
run: |
PACKAGE_ID=${{ env.package_id }}
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256
shell: bash

- name: Generate changelog
run: |
PACKAGE_ID=${{ env.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: ${{ env.package_title }} ${{ github.ref_name }}
prerelease: true
body_path: change-log.txt
files: |
./${{ env.package_id }}.s9pk
./${{ env.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 ${{ env.package_id }}.s9pk
fi
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
image.tar
syncthing.s9pk
**/node_modules/
makeStats
*.s9pk
scripts/embassy.js
.DS_Store
.vscode/
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

23 changes: 5 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
FROM syncthing/syncthing:1.23.0
FROM syncthing/syncthing:1.27.3 AS build

FROM alpine:3.15

RUN apk add --no-cache tini
RUN apk add --no-cache jq
RUN apk add --no-cache curl
RUN apk add --no-cache inotify-tools

ARG PLATFORM

RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${PLATFORM} && chmod +x /usr/local/bin/yq

COPY --from=0 /bin/syncthing /usr/bin/
RUN apk add --no-cache curl jq tini inotify-tools yq && \
rm -rf /var/cache/apk/*

RUN adduser --disabled-password syncthing_user

COPY docker_files/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY docker_files/* /usr/local/bin

COPY docker_files/health-web.sh /usr/bin
COPY docker_files/watch-and-own.sh /usr/bin
COPY docker_files/force-own.sh /usr/bin
COPY docker_files/health-version.sh /usr/bin
ENV STGUIADDRESS=0.0.0.0:8384

EXPOSE 8384/tcp
EXPOSE 22000/tcp
Expand Down
2 changes: 1 addition & 1 deletion INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Get up and running with [Syncthing on Embassy](https://github.com/Start9Labs/syncthing-wrapper/tree/master/docs/embassy-setup.md)
Get up and running with [Syncthing on your Start9 Server](https://github.com/Start9Labs/syncthing-wrapper/tree/master/docs/embassy-setup.md)

You can also view the [official Syncthing documentation](https://docs.syncthing.net/)

Expand Down
50 changes: 39 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,57 @@ DOCKER_FILES := $(shell find docker_files)
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"

# assumes /etc/embassy/config.yaml exists on local system with `host: "http://embassy-server-name.local"` configured
install: $(PKG_ID).s9pk
embassy-cli package install $(PKG_ID).s9pk
install:
ifeq (,$(wildcard ~/.embassy/config.yaml))
@echo; echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first"; echo
else
start-cli package install $(PKG_ID).s9pk
endif

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

clean-manifest:
@sed -i '' '/^[[:blank:]]*#/d' manifest.yaml
@echo; echo "Comments successfully removed from manifest.yaml file."; echo

scripts/embassy.js: $(TS_FILES)
deno bundle scripts/embassy.ts scripts/embassy.js

docker-images/aarch64.tar: Dockerfile $(DOCKER_FILES) manifest.yaml
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --build-arg PLATFORM=arm64 --platform=linux/arm64/v8 -o type=docker,dest=docker-images/aarch64.tar .
arm:
@rm -f docker-images/x86_64.tar
ARCH=aarch64 $(MAKE)

docker-images/x86_64.tar: Dockerfile $(DOCKER_FILES) manifest.yaml
x86:
@rm -f docker-images/aarch64.tar
ARCH=x86_64 $(MAKE)

docker-images/aarch64.tar: Dockerfile $(DOCKER_FILES)
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --build-arg PLATFORM=amd64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
endif

docker-images/x86_64.tar: Dockerfile $(DOCKER_FILES)
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
endif

$(PKG_ID).s9pk: manifest.yaml INSTRUCTIONS.md icon.png LICENSE.md scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar
embassy-sdk pack
ifeq ($(ARCH),aarch64)
@echo "start-sdk: Preparing aarch64 package ..."
else ifeq ($(ARCH),x86_64)
@echo "start-sdk: Preparing x86_64 package ..."
else
@echo "start-sdk: Preparing Universal Package ..."
endif
@start-sdk pack
9 changes: 6 additions & 3 deletions docker_files/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ i=0

rm /root/health-web
rm /root/health-version
mkdir /mnt/filebrowser/syncthing
mkdir -p /mnt/filebrowser/syncthing
chown -R syncthing_user /mnt/filebrowser/syncthing
su -s /bin/sh -c "HOME=/mnt/filebrowser/syncthing syncthing serve --no-restart --reset-deltas --no-default-folder" syncthing_user &
export HOME="/mnt/filebrowser/syncthing"
export STHOMEDIR="/mnt/filebrowser/syncthing/.config/syncthing"
su -s /bin/sh -c "syncthing serve --no-restart --reset-deltas --no-default-folder" syncthing_user &
syncthing_process=$!
export HOME=/mnt/filebrowser/syncthing
# wait to fix properties race condition
sleep 2

while [[ "$(syncthing cli show system)" =~ 'no such file or directory' ]] || [[ "$(syncthing cli show system)" =~ 'connection refused' ]] || [[ "$(syncthing cli config gui user get)" =~ 'connection refused' ]]; do
sleep .2
Expand Down
14 changes: 7 additions & 7 deletions docs/platforms/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

1. Download Syncthing from your application store of choice
1. Grant Syncthing the permissions it needs to operate smoothly.
1. Inside "Settings", review the various options, such as when Syncthing should run, whether or not it should run in the background, whether it should use WiFi or cellular data. These are important considerations, as they will affect your experince and may have significant impact on your battery and/or phone bill.
1. Inside "Settings", review the various options, such as when Syncthing should run, whether or not it should run in the background, whether it should use WiFi or cellular data. These are important considerations, as they will affect your experience and may have significant impact on your battery and/or phone bill.

## Add Your Embassy
## Add Your Start9 Server

1. Go to Settings -> Syncthing Options -> Device Name, and give your Android device a name you won't forget
1. Back on the main screen, in the "Devices" tab click "+"
1. In your Embassy, go to "Syncthing > Properties" and get your Embassy Syncthing device ID. This can also be obtained from your Embassy Syncthing web interface
1. Back in the Android Syncthing app, enter your Embassy device ID. You could also scan the QR code
1. In your Start9 Server, go to "Syncthing > Properties" and get your Start9 Server Syncthing device ID. This can also be obtained from your Start9 Server Syncthing web interface
1. Back in the Android Syncthing app, enter your Start9 Server device ID. You could also scan the QR code
1. We recommend disabling "Introducer" until you have had time to understand what it does and how to use it
1. Click the checkmark in the top right to save

Expand All @@ -20,8 +20,8 @@
1. In your Android Syncthing app, in the folders tab click "+"
1. Name the folder
1. Click "Directory" and select the folder you want to share
1. Turn on the toggle to share with your Embassy
1. Under "Folder Type", we recommend setting it to "Send Only". This means that your Embassy is truly just a backup. If you edit, add, or delete files inside this shared folder in your Embassy, those changes will not be honored. You Android device is the source of truth. By using "Send and Receive" or "Receive Only" you are granting your Embassy the power to edit, add, or delete files from your phone. While this is very powerful, it can also be dangerous, so be careful
1. Turn on the toggle to share with your Start9 Server
1. Under "Folder Type", we recommend setting it to "Send Only". This means that your Start9 Server is truly just a backup. If you edit, add, or delete files inside this shared folder in your Start9 Server, those changes will not be honored. You Android device is the source of truth. By using "Send and Receive" or "Receive Only" you are granting your Start9 Server the power to edit, add, or delete files from your phone. While this is very powerful, it can also be dangerous, so be careful
1. Optionally set "Watch for Changes" and "File Pull Order"
1. Tap the checkmark to save
1. This folder should immediately begin syncing to File Browser on your Embassy inside the "syncthing folder"
1. This folder should immediately begin syncing to File Browser on your Start9 Server inside the "syncthing folder"
10 changes: 5 additions & 5 deletions docs/platforms/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Currently there are no officially supported applications for iOS. The only activ
Start by downloading Möbius Sync - https://www.mobiussync.com/


# Add Your Embassy
# Add Your Start9 Server

You can add any Syncthing device to any other Syncthing device

1. In your Syncthing dashboard, click "Add Remote Device."
![Add Device](/docs/assets/lin-syncthing4.png)

1. In your Embassy, go to "Syncthing > Properties" and copy your Embassy Syncthing device ID. This can also be obtained from your Embassy Syncthing web interface
1. In your Start9 Server, go to "Syncthing > Properties" and copy your Start9 Server Syncthing device ID. This can also be obtained from your Start9 Server Syncthing web interface
1. Paste into the "Device ID" field of the Syncthing on your iOS device. You may name the device if you wish or leave blank for default.
![Device Options](/docs/assets/lin-syncthing5.png)

Expand All @@ -22,14 +22,14 @@ You can add any Syncthing device to any other Syncthing device
1. Back on the device you are adding, you will see a banner pop up and ask you to confirm adding the device. If you do not see it, wait 10 seconds and refresh the page. Click "+ Add Device."
![Connect](/docs/assets/lin-syncthing7.png)

1. Back on your Embassy Syncthing Dashboard, you will see a banner pop up and ask you to confirm adding the device. If you do not see it, wait 5 seconds and refresh the page. Click "+ Add Device."
1. Back on your Start9 Server Syncthing Dashboard, you will see a banner pop up and ask you to confirm adding the device. If you do not see it, wait 5 seconds and refresh the page. Click "+ Add Device."
1. You will see the same "Add Device" dialogue as before. Select your desired options (leaving the Device ID alone). Click "Save."

# Share A folder

1. Open the app and add any local folder you wish to share (it can be empty)
1. Under "Folder Type", we recommend setting it to "Send Only". This means that your Embassy is truly just a backup. If you edit, add, or delete files inside this shared folder in your Embassy, those changes will not be honored. Your iOS device is the source of truth. By using "Send and Receive" or "Receive Only" you are granting your Embassy the power to edit, add, or delete files from your device. While this is very powerful, it can also be dangerous, so be careful.
1. Under "Folder Type", we recommend setting it to "Send Only". This means that your Start9 Server is truly just a backup. If you edit, add, or delete files inside this shared folder in your Start9 Server, those changes will not be honored. Your iOS device is the source of truth. By using "Send and Receive" or "Receive Only" you are granting your Start9 Server the power to edit, add, or delete files from your device. While this is very powerful, it can also be dangerous, so be careful.
1. Then click "Save."
1. You can now add data to this folder and it will be shared by any device you pair with and share the folder with (next step).

That's it! The folder you selected will begin to sync immediately. This will show in both Syncthing dashboards, but we can also verify by visiting the `syncthing` folder in File Browser in Embassy to ensure the new files are there.
That's it! The folder you selected will begin to sync immediately. This will show in both Syncthing dashboards, but we can also verify by visiting the `syncthing` folder in File Browser in Start9 Server to ensure the new files are there.
10 changes: 5 additions & 5 deletions docs/platforms/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ First, download Syncthing for your system from syncthing.net, or via your packag
1. Syncthing will ask if you'd like to setup a user/password for the GUI. Since you are only accessing this on your computer, this is not necessary. If you want to expose the GUI to the network, then you may wish to add a user and password.
![Usage](/docs/assets/lin-syncthing1.png)

# Add Your Embassy
# Add Your Start9 Server

Your Syncthing dashboard is now showing with "Folders" on the left and "Devices" on the right. You may add any Syncthing device from any other Syncthing device.

1. Go to "Settings > Syncthing Options > Device Name," and give your Linux machine a name you won't forget
1. Click "Add Remote Device"
![Add Device](/docs/assets/lin-syncthing4.png)

1. In your Embassy, go to "Syncthing > Properties" and copy your Embassy Syncthing device ID. This can also be obtained from your Embassy Syncthing web interface
1. In your Start9 Server, go to "Syncthing > Properties" and copy your Start9 Server Syncthing device ID. This can also be obtained from your Start9 Server Syncthing web interface
1. Paste into the "Device ID" field of Syncthing on your Linux machine. Name the device something you will remember.
![Device Options](/docs/assets/lin-syncthing5.png)

1. Under the "Sharing" tab, you may wish to enable the device as an "Introducer," but we recommend leaving it disabled until you have time to understand what it is for and how it works. You could also choose to share additional folders here, if you had any setup. Click "Save."
![Sharing](/docs/assets/lin-syncthing6.png)

1. Back on your Embassy Syncthing Dashboard, you will see a banner pop up and ask you to confirm adding the device. If you do not see it, wait 5 seconds and refresh the page. Click "+ Add Device."
1. Back on your Start9 Server Syncthing Dashboard, you will see a banner pop up and ask you to confirm adding the device. If you do not see it, wait 5 seconds and refresh the page. Click "+ Add Device."
![Connect](/docs/assets/lin-syncthing7.png)

1. You will see the same "Add Device" dialogue as before. Select your desired options (leaving the Device ID alone). Click "Save."
Expand All @@ -39,9 +39,9 @@ We could use the default folder, but to learn the process, let's add a new folde
1. Type in a "Folder Label." If you use the name of the directory, Syncthing will make a guess at the path below. Verify this is correct and change if it is not.
![Folder Options](/docs/assets/lin-syncthing3.png)

1. Under "Folder Type", we recommend setting it to "Send Only". This means that your Embassy is truly just a backup. If you edit, add, or delete files inside this shared folder in your Embassy, those changes will not be honored. Your Linux machine is the source of truth. By using "Send and Receive" or "Receive Only" you are granting your Embassy the power to edit, add, or delete files from your Linux machine. While this is very powerful, it can also be dangerous, so be careful.
1. Under "Folder Type", we recommend setting it to "Send Only". This means that your Start9 Server is truly just a backup. If you edit, add, or delete files inside this shared folder in your Start9 Server, those changes will not be honored. Your Linux machine is the source of truth. By using "Send and Receive" or "Receive Only" you are granting your Start9 Server the power to edit, add, or delete files from your Linux machine. While this is very powerful, it can also be dangerous, so be careful.

1. Then click "Save."

That's it! The folder you selected will begin to sync immediately. This will show in both Syncthing dashboards, but we can also verify by visiting the `syncthing` folder in File Browser in Embassy to ensure the new files are there.
That's it! The folder you selected will begin to sync immediately. This will show in both Syncthing dashboards, but we can also verify by visiting the `syncthing` folder in File Browser in your Start9 Server to ensure the new files are there.

Loading

0 comments on commit e94e461

Please sign in to comment.