clem-fern / rtabby-web-api Goto Github PK
View Code? Open in Web Editor NEWTabby Web API for Config Sync
License: GNU Affero General Public License v3.0
Tabby Web API for Config Sync
License: GNU Affero General Public License v3.0
Hello, I'm having a bit of an issue as I'm using a reverse proxy to generate and store my SSL certs but when using the oauth login the callback URI is a plain HTTP url, making it fail.
Is there a way I can enable HTTPS for the callback URI without uploading a cert.pem and cert.key file? Thanks!
Hi,
I tried several settings, but I can't figure out a solution for this.
My docker-compose.yml
is as follows (SQLite template):
services:
rtabby:
container_name: rtabby-web-api
image: ghcr.io/clem-fern/rtabby-web-api:sqlite
# Minimal image without third party login
#image: ghcr.io/clem-fern/rtabby-web-api:sqlite-minimal
# Build image from local rtabby repository
#build:
# context: .
# args:
# - FEATURE_FLAGS=-F|sqlite-bundle|-F|all-login
# - GIT_COMMIT=${GIT_COMMIT}
# Optional: Minimal image without third party login
# - FEATURE_FLAGS=-F|sqlite-bundle
# If running as root, setup your user/volume owner UID and GID
#user: "1000:1000"
cap_add:
- "CAP_DAC_OVERRIDE"
cap_drop: ['ALL']
read_only: true
ports:
- "8090:8090" # <--------------------------------------------------------- CHANGED
environment:
- DATABASE_URL=sqlite:///config/db.sqlite
#- GITHUB_APP_CLIENT_ID=
#- GITHUB_APP_CLIENT_SECRET=
#- GITLAB_APP_CLIENT_ID=
#- GITLAB_APP_CLIENT_SECRET=
#- GOOGLE_APP_CLIENT_ID=
#- GOOGLE_APP_CLIENT_SECRET=
#- MICROSOFT_APP_CLIENT_ID=
#- MICROSOFT_APP_CLIENT_SECRET=
- BIND_PORT=8090 # <--------------------------------------------------------- ALSO TRIED WITH THIS SETTING
volumes:
- ./config:/config
networks:
- frontend
networks:
frontend:
name: rtabby_net_frontend
For http://:8090 and http://:8090/login I get blank pages (and the sync in Tabby does not work either :-D)
The docker compose logs
only states, that an error for HTTP 404:
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Running v0.4.2
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] users.yml loaded => 1 users found
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Third party login enabled: 0 providers found.
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Binding HTTP Listener on 0.0.0.0:8090
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Starting HTTP Listener on 0.0.0.0:8090
rtabby-web-api | [2024-06-26T19:36:51Z INFO actix_server::builder] starting 2 workers
rtabby-web-api | [2024-06-26T19:36:51Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
worker@srv /media/ANTARES/docker/rtabby-web-api $ docker compose logs
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Running v0.4.2
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] users.yml loaded => 1 users found
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Third party login enabled: 0 providers found.
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Binding HTTP Listener on 0.0.0.0:8090
rtabby-web-api | [2024-06-26T19:36:51Z INFO rtabby_web_api] Starting HTTP Listener on 0.0.0.0:8090
rtabby-web-api | [2024-06-26T19:36:51Z INFO actix_server::builder] starting 2 workers
rtabby-web-api | [2024-06-26T19:36:51Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
rtabby-web-api | [2024-06-26T19:36:57Z INFO rtabby-web-api] 192.168.178.78 "GET /login HTTP/1.1" 404 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0" 0.000130
rtabby-web-api | [2024-06-26T19:37:03Z INFO rtabby-web-api] 192.168.178.78 "GET / HTTP/1.1" 404 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" 0.000104
rtabby-web-api | [2024-06-26T19:37:10Z INFO rtabby-web-api] 192.168.178.78 "GET /login HTTP/1.1" 404 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" 0.000074
Any ideas, what I'm doing wrong?
Hi,
first of all, thank you for the solution you have provided
I know that it should be straightforward, but after following the steps, this is what I can see in the rtabby_web_api log
[2023-12-05T09:30:00Z ERROR rtabby_web_api] Encountered error on database connection: Can't connect to server on 'db' (115)
Error: MysqlConnection(BadConnection("Can't connect to server on 'db' (115)"))
The only thing that I have changed in your docker-compose file is the volume for the DB, because I like to have everything in the same folder
I have this under the db
volumes:
- ./database:/var/lib/mysql
instead of
volumes:
- database:/var/lib/mysql
I also removed the volume definition at the end
volumes:
database:
Do you have an idea what could be wrong here?
I am able to deploy on a debian 12 machine running docker following your instructions but the web page spits a 401 error message and I am unable to connect to it
As #6 (comment) say, for now user can not create a token by themself
Add route /login
, return a simple a tag page, click the a tag will open a GitHub auth URL with client_id https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#redirect-urls
Add route /loigin_redirect
to receive the callback of URL from GitHub with code, after server receive the request, it can get a GitHub access token with the code https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#2-users-are-redirected-back-to-your-site-by-github
Get GitHub user id with the access token, create a user and return the user token.
I try to add a route at user.rs, it will protect by the auth system, I'm not familiar with Rust and Actix-Web, so for now I need to learn many things to imp the idea.
It would be great to make it able to run as a service on a docker swarm, to achieve high availability.
Hi,
I can't get automatic syncing of profiles and connections to work. Only after closing and restarting Tabby, the new config is downloaded and applied only once.
When I open the developer tools window in Tabby, I can see at startup a new config is downloaded and applied, followed by a config upload. This upload is done via a http PATCH request. (See https://github.com/Eugeny/tabby/blob/fc72b4d160f606d06c015f50f1829a9491ae3dd2/tabby-settings/src/services/configSync.service.ts#L101 )
However, rtabby-web-api does not return any data with PATCH request (0 content-length, See https://github.com/Clem-Fern/rtabby-web-api/blob/master/src/routes/config.rs#L99 ) but the Tabby code expects some JSON response with a valid modified_at field. Since there is no result, the variable this.lastRemoteChange becomes an invalid Date (See line 105 of the same file).
The autoSync feature (L185) uses the lastRemoteChange variable to see if a new config must be downloaded and applied. Since the lastRemoteChanged variable is not a valid date after a config upload, the comparison in L189 will never be 'true' and hence the autoSync feature stops working.
I believe a valid fix would be to return with a PATCH request the same result as would be returned with a http GET request to get the config?
Am I the only one with this problem? Or am I missing something?
Thanks in advance
Hi,
Thanks for this implement of sync API for Tabby.
I found that this project is not ARM64 ready by default, but it's quite easy to add the ARM64 support.
All we need to do is clone the project, uncomment the build section in docer-compose
file, and modify the Dockerfile, change x86_64
into aarch64
, and it runs smoothly without any issue.
# syntax=docker/dockerfile:1
FROM rust:1.73-alpine AS builder
WORKDIR /build
COPY . .
RUN apk add --no-cache build-base && \
cargo build --target=aarch64-unknown-linux-musl --release --no-default-features -F sqlite-bundle
FROM scratch
WORKDIR /config
COPY --from=builder /build/target/aarch64-unknown-linux-musl/release/rtabby-web-api /
COPY --from=builder /build/users.exemple.yml .
CMD ["/rtabby-web-api"]
Please add SQLite support, it's more convince when self-use. I see diesel has build-in SQLite support, and if the api does not use dedicate feature of MySQL, is it possible to add sqlite feature of diesel? https://github.com/Clem-Fern/rtabby-web-api/blob/ec8c429cdcd58f152cc86a0a54d8a76b5fcd595e/Cargo.toml#L22C14-L22C14
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.