There are many free image hosting sites which you can upload your images then get URL to use it in your website or blog posts or social media sites. But there is a problem with those free sites, you will not have your own control for your data since that is free hosting. To make sure we got full control of our data, we will have to create our own self-hosting image hosting site. It has to be free and easy to set up. I am also using ShareX to capture screenshots then using built-in workflow to automatically upload to remote online storage website. The integration with ShareX will be essential feature for me as well, which might be not important for other. Ideatlly, you might want to have basic editting, expiring, and easy to backup/restore this kind of features. 

Github project Picsur meets all those requirements and this post will give you a quick guide how you can create your self hosted images bed. 

 Github Project Link: https://github.com/caramelfur/picsur

Project Features and Screenshots

Simple Main Interface:
Login Page:
System Settings:
Upload Image:
Features:
  •  Uploading and viewing images
  •  Anonymous uploads
  •  User accounts
  •  User roles and permissions
  •  Proper CORS restrictions
  •  Exif stripping
  •  Ability to keep original
  •  Support for many formats
  • QOI
  • JPG
  • PNG
  • WEBP (animated supported)
  • TIFF
  • BMP
  • GIF (animated supported)
  •  Convert images
  •  

    Edit images

    Resize

  • Rotate
  • Flip
  • Strip transparency
  • Negative
  • Greyscale
  •  Deletable images
  •  Proper DB migrations
  •  Show own images in list
  •  Correct previews on chats
  •  Expiring images
  •  ShareX endpoint
  •  ARM64 and AMD64 Docker image

Installation Pre-requirements

Free resources you might need to complete this docker project:

Pre-installed services:

  • Docker, 
    • apt update
    • apt install docker.io
    • apt install docker-compose
    • apt upgrade docker.io
    • mkdir /root/data/docker_data/<docker_name>
  • Docker-Compose (Using Ubuntu OS for the commands)
    • Docker-compose down
    • Optional command : use following command to backup your Docker data. You might need to change your folder name based on your docker configuraiton
      • cp -r /root/data/docker_data/<docker_name> /root/data/docker_data_backup/<docker_name>
    • docker-compose pull
    • docker-compose up -d
    • docker image prune
  • Portainer (Optional)
    • docker volume create portainer_data
    • docker run -d -p 9000:9000 –name portainer –restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
  • Install some applications: apt install wget curl sudo vim git (Optional)
  • aapanel with Nginx (Optional)
  • Nginx Proxy Manager (Optional)

Installation Steps

1 Log into your VPS and start to install required softwares

apt update && apt install docker.io -y && apt install docker-compose -y

2 Create a data folder 

sudo -i
mkdir -p /root/data/docker_data/picsur
cd /root/data/docker_data/picsur

3 Create Docker Composer File

vi docker-compose.yml

Here is the content of this file:

version: ‘3’
services:
  picsur:
    image: ghcr.io/caramelfur/picsur:latest
    container_name: picsur
    ports:
      – ‘8088:8080’ #8088 can be changed to other unused tcp port
    environment:
      PICSUR_HOST: ‘0.0.0.0’
      PICSUR_PORT: 8080
      PICSUR_DB_HOST: picsur_postgres
      PICSUR_DB_PORT: 5432
      PICSUR_DB_USERNAME: picsur
      PICSUR_DB_PASSWORD: Secure_DB_passw0rd  # This has be same one as configured in the settings of picsur_postgres
      PICSUR_DB_DATABASE: picsur
      ## Default admin username’s password
      PICSUR_ADMIN_PASSWORD: Secure_admin_passw0rd      
      ## optional. If not set here, it will be generated randomly. 
      # PICSUR_JWT_SECRET: CHANGE_ME
      # PICSUR_JWT_EXPIRY: 7d
      
      ## Maximum File zie
      PICSUR_MAX_FILE_SIZE: 10240000  # 10 MB
      ## No need to touch this, unless you use a custom frontend
      # PICSUR_STATIC_FRONTEND_ROOT: “/picsur/frontend/dist”
      ## Warning: Verbose mode might log sensitive data
      # PICSUR_VERBOSE: “true”
    restart: unless-stopped
    
  picsur_postgres:
    image: postgres:14-alpine
    container_name: picsur_postgres
    environment:
      POSTGRES_DB: picsur
      POSTGRES_PASSWORD: Secure_DB_passw0rd
      POSTGRES_USER: picsur
    restart: unless-stopped
    volumes:
      – ./picsur-data:/var/lib/postgresql/data 


4 Open Firewall Port

Here is an example using Oracle cloud: 


5 Test using public ip address

Get your VPSs’s public IP

Curl ifconfig.me

Access your Picsur website using public ip with defined port: http://<Public IP>:8088

NPM – Setting Up Nginx Reverse Proxy Manager

 

Update / Backup / Migrate Picsur

Following commands show how to backup and update docker: 

cd /root/data/docker_data/picsur
docker-compose down 
cp -r /root/data/docker_data/picsur /root/data/docker_data/picsur.archive  # backup
docker-compose pull
docker-compose up -d    # no need to use "docker-compose stop" to stop docker. "docker-compose up -d" will stop and auto update new docker. 
docker image prune  # prune command is used to remove all unused images

Migrate Picsure Docker:

Steps:
1. backup data folder and zip it into one file
2. transfer to a new server
3. Unzip backup file into same data folder
4. Install docker & docker-compose, then spin up docker using same docker run command or docker-compose.yml file
cd /root/data/docker_data/picsur
docker-compose down 
cp -r /root/data/docker_data/picsur /root/data/docker_data/picsur.archive  # backup to a different archive folder
docker-compose pull
docker-compose up -d    # no need to use "docker-compose stop" to stop docker. "docker-compose up -d" will stop and auto update new docker. 
docker image prune  # prune command is used to remove all unused images

ChatGPT suggested Backup Strategy for Home Data:

One of the most popular backup policies is the 3-2-1 backup rule. This rule states that you should have:

  • 3 copies of your data
  • 2 different types of media for storing the data
  • 1 copy stored offsite


This means that you should have three copies of your data: the original files and two backup copies. The original files and one set of backup data can reside at the same location but they must be stored on two different types of media. You must also have one offsite set of backup data.

For your home server, I would recommend using an external hard drive or cloud storage service to store your backups. You can use software like Veeam Backup & Replication or Acronis True Image to automate the backup process and ensure that your data is always up-to-date.

Clearn up / Remove Docker

 

It will completely remove picsur related configuration, files, etc. 
cd /root/data/docker_data/picsur
docker-compose down
cd ..
rm -rf /root/data/docker_data/picsur

Clean Up / Remove Docker

  • Delete Docker and related resources
    • cd /root/data/docker_data/<docker_name>
    • docker-compose down
    • cd ..
    • rm -rf /root/data/docker_data/<docker_name>
    • docker image prune

ShareX Custom uploader guide : Picsur Integration

What is custom uploader?

Custom uploader system in ShareX let users to upload image/text/file to hosting services or shorten/share URL. This feature is mainly used by users who host their own hosting services.

Export / Import

You can export your custom uploader with .sxcu extension which allows users to just double click that file to be able to use custom uploader.

If destination type is configured then ShareX can also set this custom uploader as selected custom uploader and change current destination to this custom uploader, so users won’t need any additional configuration to use it.

Github : https://github.com/CaramelFur/Picsur

Steps:

1. Create API Key in Picsur

2. Set up API key for Sharex then export config

3. Import Configuration into Sharex

4. Configure Custom Uploader Settings…

When you choose Test for Image uploader, you will find a ShareX icon uploaded to the Picsur site and you will have a url for the image. 

Videos

 

By Jonny

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock