eikek / sharry

Sharry is a self-hosted file sharing web application.
https://eikek.github.io/sharry
GNU General Public License v3.0
900 stars 56 forks source link

[Guide] How to compile source code #501

Closed DorimeDoge closed 3 years ago

DorimeDoge commented 3 years ago

Hello,

Could I get step by step guide how to compile source code with steps how to install Elm & Sbt for Ubuntu 18.04?

Thanks

eikek commented 3 years ago

Does this wiki page help maybe? https://github.com/eikek/sharry/wiki/Translation Or do you have some specific problems? How to install sbt/elm etc can be found on their page. Usually it is either apt-get install or npm install

eikek commented 3 years ago

Here is another page with some instructions (in case you didn't see it): https://eikek.github.io/sharry/doc/dev#building

DorimeDoge commented 3 years ago

Hello again,

I installed Sbt with help of this tutorial (https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html) and Elm with this one (https://github.com/elm/compiler/blob/master/installers/linux/README.md).

Did I get it right?

And should I compile it by make or by make-zip? Whats the difference?

Thanks

eikek commented 3 years ago

Yes, this looks good! you can check via elm --version and sbt -h.

If you want to build the zip files, then run sbt make-zip - I guess that's what you want. The make builds the whole application, but doesn't package it up into a zip file.

Edit: You also need nodejs installed for the current version. It's again apt-get install nodejs or similiar (don't use ubuntu myself).

DorimeDoge commented 3 years ago

Hello again,

Thanks for help! You said you can install Elm via npm, is it better to install it like this or in my way?

Thanks

eikek commented 3 years ago

Ah no, whatever the elm site says, is right! I think you can now just download the binary from somewhere and the npm package did just this before. So it doesn't really matter in the end. If you can run elm then it's all fine.

DorimeDoge commented 3 years ago

Hello,

Alright thanks!

DorimeDoge commented 3 years ago

Hello again :D,

And how do I need to compile? Go to directory where all source is, run stb and then stb make-zip?

eikek commented 3 years ago

What do you want to do? Maybe I can give better help then :-). The make will compile the app. The make-zip runs first make under the hood and then creates a zip file. So compilation happens on both commands. If you only want to compile, then make is better.

At first, go into the source root and just sbt. Then you get another shell, there you can type make or make-zip.

DorimeDoge commented 3 years ago

Hello,

What I want to do is to compile .zip file for usage like in releases.

Thanks

eikek commented 3 years ago

Ah ok, then you can just run sbt make-zip from your terminal inside the source root. The zip file is then in modules/restserver/target/universal/.

DorimeDoge commented 3 years ago

Hello,

I got these errors trying to compile with sbt make-zip. Please help.

image image

Thanks

eikek commented 3 years ago

Oh, I think I told you wrong :( - the make-zip doesn't call make before. You need to run make yourself. Try sbt ";make; make-zip" (from your terminal) This runs these two commands in a row.

DorimeDoge commented 3 years ago

Hello,

So as I understand I have to do:

cd /home/sharry sbt make sbt make-zip

Or

sbt ";make; make-zip"

Am I right?

Thanks

eikek commented 3 years ago

Yes, right - this should work. The second form is a bit faster, because sbt doesn't need to start twice.

DorimeDoge commented 3 years ago

Hello,

I tried sbt ";make; make-zip" and it still gave me same error:

image

Then it compiled something else and at the end it said "Killed".

I tried to find .rar file in /home/sharry/modules/restserver/target/ and there is no /universal/

Please help, Thanks

eikek commented 3 years ago

Ah these two npm warnings are not a problem I think. Are there other errors?

It's not a "rar" file, you need to look for a zip file.

DorimeDoge commented 3 years ago

Hello,

Sorry, yes .zip file, but I dont even find /home/sharry/modules/restserver/target/universal/

Question: What OS do you use to build Sharry?

Thanks

eikek commented 3 years ago

Can you find /home/sharry/modules/restserver/target/ ? Can you maybe pipe all the output into a file and send it to me?

DorimeDoge commented 3 years ago

Hello,

Yes I can find /home/sharry/modules/restserver/target/, but I cant find /universal folder.

Thanks

eikek commented 3 years ago

Ok, could you run this command like this

sbt ";make ;make-zip" 2>&1 > logfile.txt

and send me the logfile.txt file? Maybe via pastbin.com or someting like that or email?

DorimeDoge commented 3 years ago

Hello,

I used your command and here is your logs

Logs

And I got "Killed" text at the end.

Thanks

eikek commented 3 years ago

Thanks! Well, it looks a bit strange. Is nothing being output after this line

[info] compiling 20 Scala sources to /home/sharry/modules/common/target/scala-2.13/classes

(this is the last line in your logs) I don't see any error :-)

Could you try to raise the memory: sbt -mem 2048 "make ;make-zip". What system are your running this on (uname -a)?

DorimeDoge commented 3 years ago

Hello,

I tried sbt -mem 2048 "make ;make-zip" and got this error.

For uname -a I got 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux.

Thanks

eikek commented 3 years ago

Inetresting. Your machine has <1G RAM? This could be problematic. You can try to give a little more to the build but not so much :-) try -mem 780 or something like that.

DorimeDoge commented 3 years ago

Hello again,

Yes, its shitty VPS just to test Sharry, I can host Sharry but I cant compile it. :(

I tried everything you said but I just cant. It says like Compiled succesfully, then [info] compiling 20 Scala sources and etc., but kill everything of nowhere. ;(

I even tried it on not bad Windows 10 computer, same error.

Can you try to compile it by yourself to see if everything really works, please? :\

Thanks

eikek commented 3 years ago

Yes, it works. You can see the ci where it compiles and tests each change, for example: https://github.com/eikek/sharry/runs/3058770641. What you can do is fork sharry and add your own github action that compiles it etc. Or if you have a laptop lying around, this should also work.

DorimeDoge commented 3 years ago

Hello,

Oh, but what OS you are using and what Java and JDK, Nodejs versions are you using?

Thanks

eikek commented 3 years ago

I'm using NixOS (GNU/Linux on x86_64), OpenJDK 11 and NodeJS 14.17.0. The CI runs on Ubuntu (don't know what exact version, guess its 20.04).

DorimeDoge commented 3 years ago

Hello,

Should I try to install NixOS on my VPS and try to compile then?

Thanks

eikek commented 3 years ago

no, I think this won't help. I think it's too less memory etc. It builds on all Linuxes where the required tools are installed

DorimeDoge commented 3 years ago

Hello

Oh, and whats your specs?

Thanks

eikek commented 3 years ago

You don't have any other computer to build on? I don't know the minimum specs. Here on my physical machine, it runs with 400M memory (via sbt -mem 400m). It seems that the process is killed on your vps, but I don't know why. I would use another computer to build on, either the VMs from github actions (or another ci) or just use your desktop?

DorimeDoge commented 3 years ago

Hello,

As I said I already tried it on my Windows 10 computer, same error as I remember but I will check :/

Thanks

eikek commented 3 years ago

Ah sorry, forgot that :-). It might not build easily on windows (I never tried, I have no windows). But you can install virtualbox on your windows machine and create a VM there with Ubuntu. Then you can control how much memory/cpu etc it gets. I think this would work then. Alternatively you could try docker - not sure how/if that works on windows, though.

DorimeDoge commented 3 years ago

Tried with 400mem and got errors :(

eikek commented 3 years ago

What errors and where - on windows? If they are different, then you could paste it here

DorimeDoge commented 3 years ago

Maybe you have Discord? If yes could you give me it?

eikek commented 3 years ago

Unfortunately not … I use matrix?

DorimeDoge commented 3 years ago

Hello,

Oh, never mind then.

Thanks

DorimeDoge commented 3 years ago

Hello,

What are requirements to compile source? Like NodeJS, JDK, etc.

Thanks

eikek commented 3 years ago

Sharry uses tailwindcss, which requires Node.js 12.13.0 or higher (I'm using 14.17.0). Java must be at least 8 to compile and run. Elm must be 0.19.1. If you install sbt, which is required when building sharry, then Java comes as a dependency and is available automatically on most systems.

DorimeDoge commented 3 years ago

Hello again,

I tried it on VirtualBox and it works! :D

Thanks

DorimeDoge commented 3 years ago

And I want to ask, do you get same error as I do? image

eikek commented 3 years ago

Yes, I also see this. I'm not so sure why. I think there is some npm dependency that only runs on darwin (osx); since its optional it prints as a warning. And everything that is printed to stderr from the npm process is marked by sbt as [error] but npm says its WARN, so it's not a problem. From the name, fsevent could be a dev dependency for watching files - but just a guess. npm is only used to build the minimized CSS file that gets included in the application. The application itself doesn't use any npm stuff.

DorimeDoge commented 3 years ago

Hello again,

Thank you so much for everything, have a good day!