GithubHelp home page GithubHelp logo

jaemk / transfer Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 10.35 MB

Encrypted file transfer utility

License: MIT License

Rust 57.63% JavaScript 27.53% HTML 1.83% Shell 2.39% CSS 0.05% Python 8.90% Dockerfile 1.66%
encryption secure transfer transfer-utility rust filetransfer

transfer's Introduction

Transfer Build Status

Encrypted file transfer utility

Also see the command line client, transfer-cli

Development

  • Backend:
    • Install rust
    • Install postgres: apt install postgresql libpq-dev
    • Install migrant (migration manager):
      • cargo install migrant --features postgresql
    • Initialize database (postgres):
      • migrant init
      • migrant setup
      • migrant apply --all
    • Build and run backend dev server:
      • cargo run -- serve --port 3002
      • Configuration can be tweaked in config.ron
    • Poke around in the database: migrant shell
  • Frontend (inside /web):
    • Install npm
    • Install yarn
    • Build a run frontend dev server
      • yarn install
      • yarn start
      • Open http://localhost:3000
      • Api requests are proxied to the backend: localhost:3002

Release Builds

Packaged releases are built and packaged by travis-ci. Complete packaged releases are available here

  • Backend (Rust setup for cross-compilation)
    • Install docker
      • Add yourself to the docker group: sudo usermod -a -G docker <user>
      • Restart to pick up changes (logging in & out may suffice)
      • You should be able to run docker version without any errors
      • May need to start the Docker daemon if it's not already running: sudo systemctl start docker (not sure about windows/os-x)
    • Install cross: cargo install cross
    • Build server executables for targets listed in build.py script (currently only x86_64):
      • build.py server
  • Frontend (React)
    • Build frontend app bundles and copy to their static-file locations
      • build.py web

Deployment / Running Packaged Releases

postgres & nginx are required

  • Initial Setup
    • Create and enter a project directory where versioned packages can be managed:
      mkdir transfer
      cd transfer
    • Download, unpackage, and do initial setup for the latest release (see releases)
      # download
      curl -LO https://github.com/jaemk/transfer/releases/download/$TAG/transfer-$TAG-$TARGET.tar.gz
      # extract
      tar -xf transfer-$TAG-$TARGET.tar.gz
      # rename
      mv transfer $TAG
      # setup "latest" symlink
      ln -sfn $TAG latest
    • Setup an uploads directory where transfer uploads can exist between application code updates. Make sure your config.ron file is updated and copied to the config directory.
      mkdir transfer_uploads
      vim latest/config.ron  # update "upload_directory" to "/<ABS_PATH_TO>/transfer/transfer_uploads"
      # and copy to the config directory
      cp latest/config.ron `latest/bin/transfer admin config-dir`
    • Setup the database
      latest/bin/transfer admin database setup
      # Run suggested commands to create database if it doesn't exist
      # and then try settinng up migrations again
      latest/bin/transfer admin database setup
    • Apply migrations
      latest/bin/transfer admin database migrate
    • Poke around the database
      latest/bin/transfer admin database shell
    • Setup nginx
      # copy sample config and then update its details with your environment info
      sudo cp nginx.conf.sample /etc/nginx/sites-available/transfer
      # check config
      sudo nginx -t
      # enable site
      sudo ln -s /etc/nginx/sites-available/transfer /etc/nginx/sites-enabled/transfer
      sudo systemctl restart nginx
    • Setup systemd service
      # copy sample config and then update its details with your environment info
      sudo cp transfer.service.sample /lib/systemd/system/transfer.service
      # enable the service
      sudo systemctl daemon-reload
      sudo systemctl enable transfer.service
      # start!
      sudo systemctl restart transfer
      # tail the log
      sudo journalctl -fu transfer
  • Updates
    • Assuming you followed the "Initial Setup" section
    • Use the release.py script to fetch, unpackage, and symlink the latest release
      # from the `transfer` project root
      # follow prompts to download the appropriate target and replace the `latest` symlink
      latest/release.py fetch
    • Apply migrations and restart the app
      latest/bin/transfer admin database migrate
      sudo systemctl restart transfer

transfer's People

Contributors

jaemk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

privydg

transfer's Issues

Database connection pool timeouts

Handlers should be given a database pool reference instead of a pooled connection so file streaming handlers can drop their pooled connection prior to streaming data.

Set/check server & client headers

Make sure the client is setting appropriate Content-Length and Content-Type headers. Add server checks for content-type instead of trying to parse invalid json.

Use nginx X-Accel

When running behind nginx use X-Accel header to more efficiently serve files

build & deploy scripts

These share a good amount of code and should probably be combined into something like manage.

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.