diff --git a/README.md b/README.md index 9c3ed26..63b741b 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file +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 +' +``` diff --git a/docker-compose.yml b/docker-compose.yml index 804428b..d99bc64 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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/ @@ -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/ diff --git a/run.py b/run.py index 1a0034e..ba1a8d0 100644 --- a/run.py +++ b/run.py @@ -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 )