projectsend

Deploy ProjectSend r1070 in Docker Swarm, Behind Traefik v2.0

ProjectSend is a free, secure, and user-friendly file-sharing software. ProjectSend is the best open-source software.

This post is to show you how to deploy ProjectSend r1070 to our Docker Swarm Cluster using the Docker Compose tool.

ProjectSend is a free, secure and user friendly file sharing software. ProjectSend is the best open source software

learn more about using the official ProjectSend website and GitHub.

Prerequisites

Please make sure you should fulfill the below requirements before proceeding to the actual deployment.

  1. Docker Swarm Cluster with GlusterFS as persistent tool.
  2. Traefik as reverse proxy to expose micro-services to external.
  3. Database stack to host application databases.

Introduction

If you are looking to share files with your clients, focused on ease of use and privacy. ProjectSend is the best open-source software. It’s easy to use and you can self-host or deploy on your environment. It supports clients groups, system user’s roles, statistics, multiple languages, detailed logs… and much more!

ProjectSend is a clients-oriented, private file sharing web application.

Why is ProjectSend

ProjectSend is a self-hosted application (you can install it easily on your own VPS or shared web hosting account) that lets you upload files and assign them to specific clients that you create yourself!

Secure, private and easy. No more depending on external services or e-mail to send those files!

Clients are created and assigned a username and a password. Uploaded files can be assigned to specific clients or clients groups.

Other features include auto-expiration of upload, notifications, full logging of actions by users and clients, option to allow clients to also upload files, themes, multiple languages…

ProjectSend is made in php and uses a MySQL database to store the information.

ProjectSend Features

ProjectSend is easy to use and has below main features that you’ll love

  1.  Keep your private files secure – All your files are safe with ProjectSend as a self-hosted application. When you upload your private files, they are kept in your own space.
  2.  Share with clients or groups – Uploaded files can be assigned to clients or client groups that you create specially to work with and it suits all your file sharing needs.
  3.  Your clients can upload to – ProjectSend is not a one way street. Your clients can upload files to their own account too, if you enable the option.
  4.  Detailed log of actions – You will never miss a thing. Detailed panel of everything that happen on your system will be available for admins.

Some other features include

  • Statistics
  • Inactive user and clients accounts
  • Templates
  • Languages

Persist ProjectSend Data

Containers are fast to deploy and make efficient use of system resources. Developers get application portability and programmable image management and the operations team gets standard run time units of deployment and management.

With all the known benefits of containers, there is one common misperception that the containers are ephemeral, which means if we restart the container or in case of any issues with it, we lose all the data for that particular container. They are only good for stateless micro-service applications and that it’s not possible to containerize stateful applications.

I am going to use GlusterFS to overcome the ephemeral behavior of Containers.

I already set up a replicated GlusterFS volume{.rank-math-link} to have data replicated throughout the cluster if I would like to have some persistent data.

The below diagram explains how the replicated volume works.

Volume will be mounted on all the nodes, and when a file is written to the /mnt partition, data will be replicated to all the nodes in the Cluster

In case of any one of the nodes fails, the application automatically starts on other node without loosing any data and that’s the beauty of the replicated volume.

Persistent application state or data needs to survive application restarts and outages. We are storing the data or state in GlusterFS and had periodic backups performed on it.

We will use a backup of the volume to spin a new application container anywhere else in case of unexpected issues occur in the current environment.

I am going to persistent /data and /log directories of ProjectSend for disorder recovery.

Create folders in /mnt directory to persistent ProjectSend data folders.

cd /mnt
sudo mkdir -p projectsenddata
sudo mkdir -p projectsendlog

Please watch the below video for Glusterfs Installation

https://youtube.com/watch?v=VU-cxFObPjI%3Ffeature%3Doembed

Prepare ProjectSend Environment

Create a folder in /opt directory to place configuration file, i.e, .yml file for ProjectSend.

Use the below commands to create the folder.

cd /opt
sudo mkdir -p projectsend
cd projectsend
sudo touch projectsend.yml

ProjectSend Docker Compose

Open projectsend.yml created earlier with nano editor using sudo nano projectsend.yml

Copy and paste the below code in projectsend.yml

Here is the docker compose file for projectsend.

version: "3.7"
 
services:
  projectsend:
    image: linuxserver/projectsend
    depends_on:
      - db
    ports:
      - '8081:80'
    volumes:
      - /mnt/projectsenddata:/data
      - /mnt/projectsendconfig:/config
    secrets:
      - mysql_root_password
    environment:
      - DB_DRIVER=mysql
      - DB_HOST=db:3306
      - DB_NAME=projectsend
      - DB_USER=root
      - DB_PASSWORD_FILE=/run/secrets/mysql_root_password
      - TABLES_PREFIX=pst_
      - SITE_LANG=English
      - MAX_FILESIZE=2048
    networks:
      - proxy
    deploy:
      placement:
        constraints: [node.role == worker]
      replicas: 1
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=proxy"
        - "traefik.http.routers.projectsend.rule=Host(`ps.example.com`)"
        - "traefik.http.routers.projectsend.tls=true"
        - "traefik.http.routers.projectsend.tls.certresolver=default"
        - "traefik.http.routers.projectsend.entrypoints=websecure"
        - "traefik.http.services.projectsend.loadbalancer.server.port=80"
secrets:
  mysql_root_password:
    external: true
volumes:
  projectsenddata:
    driver: "local"
  projectsendlog:
    driver: "local"
networks:
  proxy:
    external: true

As I mentioned in the prerequisites, I used MariaDB as a back-end storage system for ProjectSend which was deployed earlier to our Docker Swarm environment.

Linux server has docker setup available for those that would prefer to use a containerized version of ProjectSend:

LinuxServer.io

Deploy ProjectSend using Docker Compose

Please make sure we have created a wiki database before deploying ProjectSend using the MariaDB stack deployed earlier.

Now it’s time to deploy our docker-compose file above, projectsend.yml using the below command

docker stack deploy --compose-file projectsend.yml projectsend

You can give it any name for the stack. I just named it as projectsend

Check the status of the stack by using docker stack ps projectsend

Now open any browser and type ps.example.com (whatever host URL used in the ProjectSend configuration in the docker-compose file) to access the instance.

Make sure that you have DNS entry for your application (ps.example.com) in your DNS Management Application.

You will be greeted with the below Configuration screen of ProjectSend. Complete the setup by creating an admin account.

You have to modify the ProjectSend URI, replace http with https (https://ps.example.com) as we are using Lets-encrypt with Traefik for automatic SSL Certs.

Stay tuned for other deployments in coming posts… 🙄

Leave a Reply

Your email address will not be published. Required fields are marked *