Tutorial / Installation of Superalgos Develop Setup on a NAS with Docker

Allright - for everyone who has a Synology NAS or any server with Docker installed and like to Run Superalgos there you can now also use it in the Developer or Plugins-Docs Branch.

You need a GitHub Account and a Git Personal-Access-Token

Brett (ssplatt) and I wrote a Docker Image that works.
It downloads Apline Linux with Node, installes Git and Python.

Once the Image runs as a Container it checks your Local Volume (Folder) That you mounted if Superalgos is already installed and if not it downloads Superalgos from your Respo.

You can get it here

https://hub.docker.com/repository/docker/martinb78/superalgos-docker-develop

a “Tutorial” is also here.

SUPERALGOS Node based Crypto Trading Bot

Setup to Develop Superalgos in a Docker Container

DEVELOPMENT ENVIROMENT with a Docker Container

This is a Docker Image with Linux Apline, Node.js, Git and Python3. Once the Image is launched as a container you can mount a local folder “app” to it. The Container will then download the latest Superalgos Develop version into that mounted folder.

The Dockerfiles are from here GitHub - mARTin-B78/Superalgos-Docker-Develop: Setup to Develop Superalgos in a Docker Container

Preparation - Github Account / Fork Superalgos / Personal Access Token

First you need a GitHub Account Join GitHub · GitHub
IMPORTANT! Your GitHub Username will become your Superalgos Username and also your Affiliate ID!


Login to your GitHub Account Sign in to GitHub · GitHub


You need to “Fork” Superalgos/Superalgos to your Account - So search for it and then click on “Fork”

Now you need to create a Github Personal Access Token


Click on Your user Icon at the top right and select “Settings” from the dropdown menu.


Click on Developer Settings


Click on Personal Access tokens


Click on Generate new token


Type in a Name for your Token like “Superalgos”
Set the Expiration Time, I picked “no expiration”
Check the Box at “repo” and “workflow”
and scroll down to the bottom


Click on Generate token


Copy your token and your GitHub Username and Save it somewhere save for later.

Installation in a Docker System

I assume you have a System where Docker is already installed and running. A Synology NAS in my case.
Launch Docker


Click on “Registry” search for “Superalgos” and download "martinb78/superalgos-docker-develop


Click on “Image” and once the Image finished downloading click on it and click on “launch”


In the General Settings click on “Advanced Settings”


At “Volume” click on “Add Folder”, pick a folder on Your System where you want the Superalgos files to be stored and add the Mount path “/app”


At Port Settings change the lokal Ports to 18041 and 34248 or your liking or leave it on Auto.


The “default” Ports are 18041 and 34248 - if your run more than one Superalgo Bots on your system you need to change them.


Click on the “Enviroment” tab and

  • Paste in your GitHub Username
  • Paste in your GitHub Personal Access Torken
  • and Paste in your Github Username inbetween the Github Repository_URL
    you need to have Forked Superalgos/Superalgos for this to work


Once you put in your GitHub details - click on Apply


You can Change the Name of the Container to your liking and click on Next


Check the details and click on “Apply”


Click on “Container” and on the name of the Container you just created and then on “Details”


Click on “Terminal” and be patient. Now the Container downloads Superalgos from your Fork and installes it into the
Mounted Folder you picked earlier. That can take a while.
Wait until it is finished and you see “Superalgos Platform App is Running” in the Terminal Window.

Setup Superalgos to be able to Contribute and Commit changes


Launch a Webbrowser (prefered googel chrome) and type in the IP of your NAS or Computer that Runs Docker togeather
with the default Superalgos Port (or the one you picked earlier)


Stop the Tutorial, and right click on the black Background
Click on “LAN Network” to check the Settings


Hover over “My Computer” LAN Network Node


Click on “Configure”


Type in your IP from your Server (NAS / or the computer that runs Docker) togeather with the Port


Click on the APIs Node


Click on the PLUS in the bottom left


Hover Over "New Github API and click on Configure


Check the GitHub Username and Personal Access Torken


Typein your GitHub Username and Personal Access Torken inbetween the quoation marks.

Check if you are able to Contribute with Superalgos


click on the “Docs” Icon at the right side.


Check out the Search and Command Field


type in “app.update” in the Command Field and hit Enter


Superalgos looks now for updates.


If a new update is found it downloads and installes it. You can see the Message “Update Done”


Scroll down all the way to the footer of the Docs.


Click on the Flag of your Language you want to use / Translate
and click on eighter “Plugins-Docs” or “Develop” on “Choose the Current Branch” and “Contribution Branch”

DONE!

2 Likes

The Image works but is not perfect yet.

I have put the code that I use to create the Docker Image at

1st issue - if any error occurs it stops the container.
Not sure if this line of code is really necessary

set -eo pipefail

2nd issue
user and group “superalgos” fails on a raspberry pie - so I used 1000:1000 instead -
which made the user and group “root” on my NAS - not ideal.

3rd - make a better check if it Superalgos Needs to be updated…

UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
# update code
echo UPDATE CORE
cd /app/Superalgos
	git checkout ${BRANCH}
		if [ $LOCAL = $REMOTE ]; then
			echo "YOUR FORK IS ALREADY UP TO DATE WITH THE UPSTREAM"
		elif [ $LOCAL = $BASE ]; then
			echo "NEED TO PULL AN UPDATE"
			echo "MAKEING SURE YOUR FORK IS IN SYNC WITH SUPERALGOS"
			git fetch upstream
		elif [ $REMOTE = $BASE ]; then
			echo "NEED TO PUSH"
			git push
			else
			echo "Diverged"
		fi	

4th - I would like to implement to ask the user to input the environment variables like git username, personal access token, email…

echo Which Branch of Superalgos do you want to install
echo [1] Master
echo [2] Develop
read BRANCH

if the user hits 1 - go straight to the installation process
if the user hits 2 ask more

echo Please type in your Git Username
read GIT_USERNAME

echo Please type in your Git Personal Access Token
read GIT_PERSONAL_ACCESS_TOKEN

echo Please type in your E-Mail you used to signup at Git
read GIT_EMAIL_ADDRESS

And also when the installation is done… to have a timeout with a question

timeout 20s echo Do you want to 
echo [1] start superalgos
echo [2] start shell
read SUPERALGOSorSHELL

if [ $SUPERALGOSorSHELL == "1" ]
then 
    echo STARTING SUPERALGOS
    node platform minMemo noBrowser
else
if [ $SUPERALGOSorSHELL == "2" ]; 
then 
   sh 
else
echo not a valid imput
fi
fi

That is just a rough sketch

Or maybe something like this here
https://www.py4u.net/discuss/1720458