Giter Site home page Giter Site logo

rtabby-web-api's Introduction


Tabby Web (API only)

Tabby Web API for Config Sync writen in Rust

License

About The Project / Disclamer

This project has been made on educational purpose. It is not a fork of Eugeny/tabby-web and not affiliated to @Eugeny Tabby terminal project. You can't expect any support from there while using this project.

As tabby web public instance app.tabby.sh has been discontinued. I decided to publish this as it provides a light, quick and easy way to deploy your own tabby config sync service. However, keep in mind that you used it at your own risk.

Getting Started

Run your own instance with docker compose.

Prerequisites

  • Linux (AMD64/x86_64) with docker engine.

Installation

  • Using rtabby-web-api image from Github Docker Repository (recommended)

    mkdir -p rtabby-web-api/config
    cd rtabby-web-api
    wget https://raw.githubusercontent.com/Clem-Fern/rtabby-web-api/master/docker-compose.yml
  • From source

    git clone https://github.com/Clem-Fern/rtabby-web-api
    cd rtabby-web-api

    Edit docker-compose.yml to use local context build instead of the published image

    # Uncomment build line
    build: .
    # Comment image
    #image: ghcr.io/clem-fern/rtabby-web-api

Configuration

  1. Create config directory. It will be used to store your config and certificate(not mandatory)

    # pwd
    # ./rtabby-web-api
    mkdir config
    
    # Only from source installation and optional
    # users.yml file will be created at first start 
    # cp users.exemple.yml config/users.yml
  2. Add some user into users.yml.

    users:
    #...
        - name: 'You'
          token: 'token'
    #...

    Token must be a valid and unique uuid v4. You can create one here.

  3. (Optional) SSL/TLS

    Place your key and certificate into config directory. Then add the following lines in docker-compose.yml :

          ports:
            - "8080:8080"
          environment:
            - DATABASE_URL=mysql://tabby:tabby@db/tabby
            - SSL_CERTIFICATE=cert.pem
            - SSL_CERTIFICATE_KEY=cert.key
          volumes:
            - ./config:/config
  4. Miscellaneous

    rtabby-web-api get his configurations from env vars. Available tweaks :

    ENV VAR DESCRIPTION EXAMPLE DEFAULT
    DATABASE_URL Url to database sqlite:///config/db.sqlite -
    CONFIG_FILE Url to configuration file (Optional) my_config.yml users.yml
    BIND_ADDR Address listening on (Optional) 0.0.0.0 0.0.0.0
    BIND_PORT Port listening on (Optional) 8989 8080
    SSL_CERTIFICATE Server certificate (Optional) cert.pem None
    SSL_CERTIFICATE_KEY Server certificate private key(Optional) private.key None
    CLEANUP_USERS Delete configurations own by unknown user (Be careful)(Optional) true false

Getting Started (Sqlite)

Run your own instance with docker compose using only one container with Sqlite.

Prerequisites

  • Linux (AMD64/x86_64) with docker engine.

Installation

  • Using rtabby-web-api image from Github Docker Repository (recommended)

    mkdir -p rtabby-web-api/config
    cd rtabby-web-api
    wget https://raw.githubusercontent.com/Clem-Fern/rtabby-web-api/master/docker-compose-sqlite.yml
  • From source

    git clone https://github.com/Clem-Fern/rtabby-web-api
    cd rtabby-web-api

    Edit docker-compose-sqlite.yml to use local context build instead of the published image

    # Uncomment build line
    build:
      context: .
      dockerfile: Dockerfile-sqlite
    # Comment image
    #image: ghcr.io/clem-fern/rtabby-web-api:sqlite

Configuration

  1. Create config directory. It will be used to store your config and certificate(not mandatory)

    # pwd
    # ./rtabby-web-api
    mkdir config
    
    # Only from source installation and optional
    # users.yml file will be created at first start 
    # cp users.exemple.yml config/users.yml
  2. Add some user into users.yml.

    users:
    #...
        - name: 'You'
          token: 'token'
    #...

    Token must be a valid and unique uuid v4. You can create one here.

  3. (Optional) SSL/TLS

    Place your key and certificate into config directory. Then add the following lines in docker-compose-sqlite.yml :

          ports:
            - "8080:8080"
          environment:
            - DATABASE_URL=sqlite:///config/db.sqlite
            - SSL_CERTIFICATE=cert.pem
            - SSL_CERTIFICATE_KEY=cert.key
          volumes:
            - ./config:/config
  4. Miscellaneous

    rtabby-web-api get his configurations from env vars. Available tweaks :

    ENV VAR DESCRIPTION EXAMPLE DEFAULT
    DATABASE_URL Url to database sqlite:///config/db.sqlite -
    CONFIG_FILE Url to configuration file (Optional) my_config.yml users.yml
    BIND_ADDR Address listening on (Optional) 0.0.0.0 0.0.0.0
    BIND_PORT Port listening on (Optional) 8989 8080
    SSL_CERTIFICATE Server certificate (Optional) cert.pem None
    SSL_CERTIFICATE_KEY Server certificate private key(Optional) private.key None
    CLEANUP_USERS Delete configurations own by unknown user (Be careful)(Optional) true false

Usage

  • Go to Usage (Sqlite) to run rtabby-web-api using only one container with Sqlite.

  • To deploy

    docker compose up -d
  • To shut down your deployment:

    docker compose down

Usage (Sqlite)

  • To deploy

    docker compose -f docker-compose-sqlite.yml up -d
  • To shut down your deployment:

    docker compose -f docker-compose-sqlite.yml down

Contributing

Build dependencies:

  • Docker
  • libmysqlclient for the Mysql backend (diesel depend on this)
  • Rust 1.65 or later
  • Diesel-rs to interact with migrations and schemas

Feel free to fork, request some features, submit issue or PR. Even give me some tips if you want, to help improve my code and knowledge in Rust ;)

rtabby-web-api's People

Contributors

clem-fern avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.