Giter Site home page Giter Site logo

cassiemeharry / ttsmagic Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 662 KB

A small webapp to convert Magic: the Gathering decks into a format acceptable by Tabletop Simulator

Home Page: https://ttsmagic.cards/

Nix 6.19% Rust 91.84% Makefile 0.46% HTML 0.31% CSS 1.05% Shell 0.15%
magic-the-gathering tabletop-simulator webapp rust

ttsmagic's Introduction

ttsmagic.cards

Copyright Cassie Meharry [email protected]

This builds an executable, ttsmagic-server, that serves a webapp that converts Magic: the Gathering decks listed online elsewhere into Tabletop Simulator decks.

Building

The shell.nix environment includes a Rust installation that's capable of building both the server and frontend. cargo build and cargo run should both work, though the latter may require a few environment variables set before anything useful happens.

Deployment.

This application is currently deployed with Docker. There is a Nix derivation in nix/docker-image.nix that builds a minimal container for the application. The Makefile includes a deploy target that builds that derivation and uploads it to the production site. You can run make overriding the DEPLOY_HOST variable to change the server it deploys to.

The application requires a TOML-formatted file containing two secrets labeled steam_api_key and session_private_key_hex. If it's not explicitly named (either as an argument or environment variable), the app will load secrets.toml from the app root.

The application looks for the following environment variables:

Environment Variable Required
DB_HOST no
DB_PORT no
DB_NAME no
DB_USER no
DB_PASSWORD yes
HOST no
REDIS_HOST yes
REDIS_PORT no
REDIS_USER no
REDIS_PASSWORD no
SECRETS_TOML no
SENTRY_DSN no
WEB_PORT no
WS_PORT no

nginx proxy

The server command expects HTTP to be served at the root directory, and the WS port to be served at /ws/. This can be achieved with nginx like this:

server {
    location / {
        proxy_pass http://127.0.0.1:$WEB_PORT/;
        proxy_http_version 1.1;
        proxy_read_timeout 300s;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }

    location /ws/ {
        proxy_pass http://127.0.0.1:$WS_PORT/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}

…with $WEB_PORT and $WS_PORT replaced with values the correct ports to connect to the app server.

ttsmagic's People

Contributors

cassiemeharry avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

00mjk

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.