Skip to content

Commit

Permalink
Merge pull request #41 from jamesoncollins/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
jamesoncollins authored Jan 1, 2025
2 parents c6695bf + 901f078 commit 5490ad2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,27 @@ a secrets.sh file in the same folder as the repo.
When you first run this you need to boot signal-cli in normal mode in order
to link it to your account. You do that by having it generate a qr code
that you scan with your phone. See the signalbot documentation. tldr:
http://localhost:8181/v1/qrcodelink?device_name=local
http://localhost:8181/v1/qrcodelink?device_name=local


Manually running signal-cli from command line. Be sure to stop the instance
first:

```
docker run --env "MODE=json-rpc" --env "PORT=8181" --env "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" --env "GIN_MODE=release" --env "BUILD_VERSION=0.90" --env "SIGNAL_CLI_CONFIG_DIR=/home/.local/share/signal-cli" --env "SIGNAL_CLI_UID=1000" --env "SIGNAL_CLI_GID=1000" --entrypoint "/entrypoint.sh" --volume "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/app-1_signal-cli-data/_data:/home/.local/share/signal-cli" bbernhard/signal-cli-rest-api:latest
```

This was generated with:

```
container_id="signal-cli"
docker inspect $container_id | jq -r '
.[] |
"docker run " +
(if .Config.Env then (.Config.Env | map("--env \"" + . + "\"") | join(" ")) else "" end) + " " +
(if .Config.Entrypoint then "--entrypoint \"" + (.Config.Entrypoint | join(" ")) + "\" " else "" end) +
(if .Mounts then (.Mounts | map("--volume \"" + .Source + ":" + .Destination + "\"") | join(" ")) else "" end) + " " +
(if .Config.Cmd then (.Config.Cmd | join(" ")) else "" end) +
" " + .Config.Image
'
```
22 changes: 12 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ services:
GIT_REPO_PATH: /root/git/turbo-bot/ # dont change this unless you change the volume below
GIT_REPO_BRANCH: main
SETUP_SCRIPT_NAME: setup.sh
SETUP_SCRIPT_URL: $${GIT_REPO_URL/\.git/}/raw/$${GIT_REPO_BRANCH}/$${SETUP_SCRIPT_NAME}
entrypoint: ["/bin/bash", "-c"]
command: >
'
cd /tmp && ( rm $$SETUP_SCRIPT_NAME || true ) &&
curl -o "$$SETUP_SCRIPT_NAME" -sfL "$$SETUP_SCRIPT_URL" &&
chmod +x "$$SETUP_SCRIPT_NAME" &&
./"$$SETUP_SCRIPT_NAME"
export SETUP_SCRIPT_URL="$${GIT_REPO_URL/\.git/}/raw/$${GIT_REPO_BRANCH}/$${SETUP_SCRIPT_NAME}"
echo SETUP_SCRIPT_URL is "$${SETUP_SCRIPT_URL}" && sleep 5 &&
echo cd && cd /tmp &&
echo curl -o $$SETUP_SCRIPT_NAME -sfL "$${SETUP_SCRIPT_URL}" && curl -o $$SETUP_SCRIPT_NAME -sfL "$${SETUP_SCRIPT_URL}" &&
echo chmod && chmod +x "$$SETUP_SCRIPT_NAME" &&
echo launch && ./"$$SETUP_SCRIPT_NAME"
'
volumes:
- signal-bot-data:/root/git/
Expand All @@ -53,14 +54,15 @@ services:
GIT_REPO_PATH: /root/git/turbo-bot/ # dont change this unless you change the volume below
GIT_REPO_BRANCH: devel
SETUP_SCRIPT_NAME: setup.sh
SETUP_SCRIPT_URL: $${GIT_REPO_URL/\.git/}/raw/$${GIT_REPO_BRANCH}/$${SETUP_SCRIPT_NAME}
entrypoint: ["/bin/bash", "-c"]
command: >
'
cd /tmp && ( rm $$SETUP_SCRIPT_NAME || true ) &&
curl -o "$$SETUP_SCRIPT_NAME" -sfL "$$SETUP_SCRIPT_URL" &&
chmod +x "$$SETUP_SCRIPT_NAME" &&
./"$$SETUP_SCRIPT_NAME"
export SETUP_SCRIPT_URL="$${GIT_REPO_URL/\.git/}/raw/$${GIT_REPO_BRANCH}/$${SETUP_SCRIPT_NAME}"
echo SETUP_SCRIPT_URL is "$${SETUP_SCRIPT_URL}" && sleep 5 &&
echo cd && cd /tmp &&
echo curl -o $$SETUP_SCRIPT_NAME -sfL "$${SETUP_SCRIPT_URL}" && curl -o $$SETUP_SCRIPT_NAME -sfL "$${SETUP_SCRIPT_URL}" &&
echo chmod && chmod +x "$$SETUP_SCRIPT_NAME" &&
echo launch && ./"$$SETUP_SCRIPT_NAME"
'
volumes:
- signal-bot-devel-data:/root/git/
Expand Down
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ async def handle(self, c: Context):
attachments = handler.get_attachments()
except Exception as e:
msg += "\nfailed to download\n"
msg += "Handler {handler_name} exception: {e}"
msg += f"Handler {handler_name} exception: {e}"
attachments = []
try:
await c.reply( LOGMSG + msg, base64_attachments=attachments )
Expand Down

0 comments on commit 5490ad2

Please sign in to comment.