IgorTimofeev / MineOS

Home of MineOS and it's software for OpenComputers mod
Other
754 stars 191 forks source link

(not issue) How did you make the server? #504

Closed cadergator10 closed 1 year ago

cadergator10 commented 1 year ago

I didn't know of a better way to contact you, so I just am using the mineos issue thing. I am wanting to make a server that my programs can sync up with to download stuff, very much like the App Market on MineOS. I was wondering if there were any tips or information on how you made yours?

IgorTimofeev commented 1 year ago

You will need 3 things: the HTTP-server (similar to where websites are hosted), then database where all your applications will be stored, and the API that OpenComputers clients will use

The operating system of the server doesn't really matter, but I'll assume you'll be using some "easy" linux distribution like debian/ubuntu

  1. Install a database management system. If this is your first experience with databases, then I highly recommend using MariaDB/MySQL because of its simplicity. You can also check out a couple of guides on YouTube to understand why the fuck do you need it

  2. Install a web server such as Nginx/Apache with link to any programming language convenient for you such as PHP/Python. Server will accept requests from OpenComputers clients, fetch some data from database and send a response back to clients

  3. Set up remote access to the database and web server. After that, you can always connect to your host from your home PC via command line or via IDE interface

  4. Install any PhpStorm/PyCharm development environment on your home computer. Usually you can write API code and work with the database directly in IDE without having to download a lot of separate software to do that. So if you don't want to suffer from butthurt - install an IDE. If you want to go the "hard oldschool way" - VS Code/Sublime Text + WinScp/FileZilla + Putty/SSH + HeidiSQL/DBeaver will help you. But wtf

  5. Design the database for your needs. If you want to create some kind of app store - you will need need a user accounting system with logins/passwords, as well as a list of publicly hosted applications

  6. Develop an API that connects to the database and provides basic functionality for registering/authorizing, getting a list/creating/modifying/deleting applications in the store on behalf of any owner user

The communication protocol between the server and the client via API is not particularly important: JSON is simple and most commonly used, but you can choose any on your taste - XML, for example

When writing a public API, always keep potential security risks in mind. Google a couple of guides of SQL injections, as well as measures to counteract them (hint: in 99% of cases, prepared SQL queries are more than enough)

  1. Write a client application for OpenComputers that can communicate with your API, allowing you to register/login/download applications

If you need check for updates of previously downloaded applications, store their version in the database, increase the version value with each update and keep downloaded version info on client. Thus, the client can always understand whether he has downloaded an up-to-date or outdated version of the application

cadergator10 commented 1 year ago

Thank you so much! I'll look into this :)

On Thu, Nov 10, 2022, 1:37 PM IgorTimofeev @.***> wrote:

You will need 3 things: a server (similar to where websites are hosted), a database where all your applications will be stored, and an API that OpenComputers will access

The operating system of the server doesn't really matter, but I'll assume you'll be using some "easy-to-use" linux distribution like debian/ubuntu

1.

Install a database management system. If this is your first experience with databases, then I highly recommend using MariaDB/MySQL because of its simplicity. You can also check out a couple of guides on YouTube to understand why the fuck do you need it 2.

Install a web server such as Nginx/Apache with link to any programming language convenient for you such as PHP/Python. Thes two guys will process requests from OpenComputers and send a response with data back to it 3.

Set up remote access to the database and web server to always be able to connect to the server from your home computer 4.

Install any PhpStorm/PyCharm development environment on your home computer. Usually you can write API code and work with the database directly in IDE without having to download a lot of separate software to do that. So if you don't want to suffer from butthurt - install an IDE 5.

Design the database for your needs. If you want to create some kind of app store - you will need need a user accounting system with logins/passwords, as well as a list of publicly hosted applications 6.

Develop an API that connects to the database and provides basic functionality for registering/authorizing, getting a list/creating/modifying/deleting applications in the store on behalf of any owner user

The communication protocol between the server and the client via API is not particularly important: JSON is simple and most commonly used, but you can choose any on your taste - XML, for example

When writing a public API, always keep potential security risks in mind. Google a couple of guides of SQL injections, as well as measures to counteract them (hint: in 99% of cases, prepared SQL queries are more than enough)

  1. Write a client application for OpenComputers that can communicate with your API, allowing you to register/login/download applications

If you need checkinf for updates of previously downloaded applications, store their version in the database, increase the version value with each update and keep downloaded version info on client. Thus, the client can always understand whether he has downloaded an up-to-date or outdated version of the application

— Reply to this email directly, view it on GitHub https://github.com/IgorTimofeev/MineOS/issues/504#issuecomment-1310740398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR46MULLIFCSNYVPYPYHAN3WHU6HPANCNFSM6AAAAAAR42AYTA . You are receiving this because you authored the thread.Message ID: @.***>