PsiTransfer Documentation

repository·master·Indexed 23 days ago

https://github.com/psi-4ward/psitransfer

A simple, open-source, self-hosted file-sharing solution designed as an alternative to services like Dropbox or WeTransfer. PsiTransfer supports large files via streaming, resumable uploads and downloads using the tus.io protocol, and password-protected download lists. It can be deployed via Docker, as a Systemd service, or from source using Node.js.

Tokens
4.2K
Snippets
15
Records
30
Agent score
84%

What's inside PsiTransfer

  1. Deploy PsiTransfer using Docker

    master

    The easiest and recommended way to run PsiTransfer is via the official Docker container. You can run the container in daemon mode, mount a local directory for data persistence, and map the container port to your host port.

    To start a basic instance, use the following command. Note that the data volume requires the host directory to have UID 1000 permissions.

    docker run -d -v $PWD/data:/data -p 3000:3000 psitrax/psitransfer
  2. Override configuration using environment variables

    master

    You can overwrite any configuration value by using environment variables prefixed with PSITRANSFER_. Environment variables have the highest priority in the configuration hierarchy.

    To use this, export the variables before starting the application. For example, to set a custom port and custom retention settings:

    export NODE_ENV=dev
    export PSITRANSFER_RETENTIONS='{"one-time":"one time","3600":"1 Hour"}'
    export PSITRANSFER_PORT=8080
    node app.js
  3. Install PsiTransfer via Docker

    master

    You can run PsiTransfer using Docker by mapping port 3000 and providing an admin password. Ensure the data volume directory is owned by UID 1000 to avoid permission issues.

    Available image tags:

    • latest: corresponds to master branch
    • 2: latest stable 2.x.x
    • 1.1: latest stable 1.1.x
    • 1.0.0: exact version
    $ docker run -p 0.0.0.0:3000:3000 -e PSITRANSFER_ADMIN_PASS=secret -v $PWD/data:/data psitrax/psitransfer
    # data volume needs UID 1000
    $ sudo chown -R 1000 $PWD/data
  4. Configure SSL support

    master

    While it is recommended to use a reverse proxy like Nginx for SSL termination, PsiTransfer supports native SSL. To enable it, provide the following options in your configuration:

    • sslPort: The port to use for SSL connections.
    • sslKeyFile: Path to the SSL key file.
    • sslCertFile: Path to the SSL certificate file.

    To disable HTTP entirely and only allow HTTPS, set the port configuration value to false.

    You can generate a self-signed certificate using:

    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout cert.key -out cert.pem
  5. Customize the PsiTransfer UI

    master

    You can alter the appearance of the upload and download pages by modifying the Pug templates. To add your own logo and styles, edit:

    • public/pug/upload.pug
    • public/pug/download.pug

    Note: It is requested to keep a footnote like Powered by PsiTransfer.

  6. Configure PsiTransfer via Docker environment variables

    master

    You can customize PsiTransfer settings by passing environment variables using the -e flag in your docker run command.

    Common configuration tasks include:

    • Changing the internal application port using PSITRANSFER_PORT.
    • Setting the default file retention time using PSITRANSFER_DEFAULT_RETENTION (in seconds).

    Note that if you change the internal port via PSITRANSFER_PORT, you must also update your Docker port mapping (-p) to match.

    docker run -v $PWD/data:/data -p 3000:8080 \
      -e PSITRANSFER_PORT=8080 \
      -e PSITRANSFER_DEFAULT_RETENTION=3600 \
      psitrax/psitransfer
  7. Install PsiTransfer using precompiled releases

    master

    To run the precompiled version, ensure you have Node.js version 12 or higher installed. Download the latest release package from the GitHub releases page, extract it, and then install dependencies in production mode.

    # Be sure to have NodeJS >= 12
    $ node -v
    v12.4.0
    
    # Download and extract latest release package from
    # https://github.com/psi-4ward/psitransfer/releases
    
    # Install dependencies and start the app
    $ NODE_ENV=production npm install
    $ npm start
  8. Install PsiTransfer from source

    master

    To build and run from the source repository, you must first compile the frontend applications located in the app directory before installing the main dependencies.

    # Compile the frontend apps
    $ cd app
    $ npm install
    $ npm run build
    
    # Install dependencies
    $ cd ..
    $ npm install
    $ npm start
  9. Configure PsiTransfer using environment-specific config files

    master

    PsiTransfer loads configuration files based on the NODE_ENV environment variable. It searches for a file named config.<NODE_ENV>.js in the root folder.

    • If you run with npm start, NODE_ENV defaults to production, so it looks for config.production.js.
    • If you run with npm run dev, it looks for config.dev.js.
    • You can use custom environments by setting NODE_ENV manually. For example, setting NODE_ENV=custom will cause the app to look for config.custom.js.

    It is recommended to use these environment-specific files rather than modifying the base config.js directly.

    NODE_ENV=custom node app.js