-
Notifications
You must be signed in to change notification settings - Fork 0
Installation Guide
Throughout this guide, you'll learn how to install the app using either:
- docker-compose (Intermediate)
- Ansible (Easy)
This guide does assume you are at least somewhat familiar with Linux systems, and already have everything running for the option you picked to install with.
Before we continue, the steps we are doing here can be done automatically from the ansible playbook below.
- You need to have docker and docker-compose installed and working
- You need to have ports
80,4000,5000,27017available for the different services to use them - You need to have a good amount of storage to store the files
First, you need to clone the respository to your server (not your compuer)
git clone https://github.com/davidilie/sharex-upload-server.git && cd sharex-upload-serverWith that done you need to navigate to the docker-compose deployment category.
cd deployment/docker-composeWith that now, you need to open the .yml file with your editor of choice.
nano docker-compose.ymlAs I can't know your precise configuration, I will just point out the variables you can change in both the frontend and backend
-
MONGO_URI- The URI of your MongoDB instance (default:mongodb) -
FRONTEND_URL- The URL of your frontend instance (default:http://localhost) -
API_URL- The URL that the server will be running on (defaulthttp://localhost) -
ACCESS_TOKEN_SECRET- IT IS MANDATORY that you change this to something random, if you don't change it, a malicious attacker can generate authentication tokens using the default token (default:ioasbdiuabsdiuasduibasdo)
-
APP_URL- The URL of your frontend instance (default:http://localhost) -
API_URL- The URL that the server will be running on (defaulthttp://localhost) -
SERVER_API_URL- The URL that your frontend will locally make requests to (defaulthttp://server:4000)
- You can modify the
docker-compose.yamlfile to use a different path for the MongoDB database or thestoragefolder. - You can modify the nginx configuration by modifying the file
./nginx.conf
Once you're sure that you configured everything to your needs, you can run this command to start up the services.
docker-compose up -dThis will pull the docker images and configure them according to your configuration.
The entire app should now be setup!
We're going to be using Ansible, a basic automation tool which installs everything we do the docker-compose option automatically.
- You need to have ports
80,4000,5000,27017available for the different services to use them - You need to have a good amount of storage to store the files
Don't let this worry you, if you don't understand, move on and come back to this later.
sudo apt-get install -y ansibleIt's good to restart your SSH connection now so that ansible and ansible-galaxy will be available.
git clone https://github.com/davidilie/sharex-upload-server.git && cd sharex-upload-serverWith that done you need to navigate to the docker-compose deployment category.
cd deployment/ansibleInstall requirements: ansible-galaxy collection install -r requirements.yml.
Once in the directory, you should see two files:
-
example.config.yml- Stores the configuration for your install -
example.inventory.ini- Keeps the IP address of your server
You need to make your own copy of these two files so we can modify them:
cp example.config.yml config.yml
cp example.inventory.ini inventory.iniLet's first modify the inventory.yml file to point to the IP address of your server, or enable the second flag if you're installing on the same machine you're running ansible:
# make sure to change the ansible_user flag to your own username
[sharex-upload-server]
192.168.1.214 ansible_user=david
# Comment out the previous line and uncomment this to run inside your server.
# 127.0.0.1 ansible_connection=local ansible_user=davidFinally, you need to modify the config.yml file to your needs and use the comments on top as reference:
# Location where configuration files will be stored.
config_dir: "~"
# Make sure this points to your PRODUCTION url!
frontend_url: "http://localhost"
backend_url: "http://localhost"
# Authorization - Make sure you change this!
access_token_secret: "iansdibasdibasdibasidu"
# Path for where the uploads are stored
upload_dir: "~/uploads"If you have another disk where you would like to store your uploaded files (such as an HDD, mounted network share, etc). You can modify the upload_dir path to point to your location where you would like to store your data.
This is (in my opinion), the most satisfying part of this process as you see everything installing automatically. In order to witness such experience, run this command:
ansible-playbook main.yml --become --ask-become-passThis installs everything required and also starts it too. After its done, the entire app should now be setup!
You can try visiting the site in your browser, if everything is set up correctly you should be presented with a login screen, you can log in using the credentials below as an admin user.
- Username: sharex@example.com
- Password: password
Now that the media server should've been setup you can check out the setting up ShareX guide to learn how to setup ShareX so that it can properly talk to the media server.
Warning: This project is still a work-in-progress. Because of this, I am not responsible for any damages that are caused to your infastructure/system. You can report bugs here.