I'm trying to compile Snap Framework for Haskell on my ubuntu vps with VERY limited ram (220mb) and I keep getting errors about running out of memory when using "cabal install snap". I have tried to increase the swap size but because it is a OpenVZ box there is essentially no swap that exists.
My question is then is there some way I can use an external machine to compile all the files and then have them transfer to the correct locations on the VPS as if I had compiled it locally there?
Or if anyone else has any other suggestions on how I might be able to get this to work please let me know.
As Thomas M. DuBuisson stated you just need to compile the entire project into the final binary and copy that and all the project files (html, js, etc.) over to the server. Because the entire project is compiled and includes a webserver those are the only files you need.
So to reiterate the steps.
Get a different machine with the same operating system that can compile the framework. In my case I had a local virtual machine do it.
Compile the entire Snap project using that machine.
Copy the compiled project (binary, and web files) to the other machine (that can't compile).
Run the binary. It includes a server so there should not be any other dependencies. Unless your project utilizes dynamic libraries. In that case copy those over as well.
This works because the actual Snap Server is included with the Snap Framework application when you compile it. The answer is actually much simpler then I thought, and I was just overcomplicating it.
Related
I'm looking for the proper way to distribute/deploy a node.js app that would run as a small webserver on the user's machine.
Is there a stub method or install script or a "install wizard" that would download all node_modules dependencies, download the latest nodejs binary, set up the environment, etc... or I have to distribute it bulk with everything packed? Is there any guide for that purpose?
Edited :
You could install node and npm, download your dependencies by running npm install in the command line (first declare them within your package.json) only then users can run your script. This is how you do development in Node.js, or deploy to a development server. See using npm. You could automate that with a shell script if that is what you are after.
However, when distributing programs to end-users that might not be the best approach. Linux users are used to a package (.deb for instance) and Windows users are used to an .exe or a setup wizard.
That is why I recommended the tools below. I also assumed you were targeting Windows as this is less of a problem is unix-like environments.
If you want a single file (.exe), pkg and nexe are made for that purpose. These Node.js tools are used by the developer to compile JavaScript code into a single executable binary that is convenient for end-users and Windows deployment. The resulting .exe file is very light and does not require node to be installed on the end-user’s computers.
Electron along with electron-packager can produce setup wizards, but it installs a lot of files even for the smallest program. Your program will include all of node and webkit, that is why it produces heavy installs.
NSIS can also create a setup wizard, it is simple and does common stuff well (copying files, running shell scripts).
Original answer:
Short answer is: not really.
You have to keep in mind that Javascript is and has always been interpreted, so until recently never compiled to binary as you might do with other languages. Some exploration has been going on, but essentially you won’t get a "good practice" answer.
The long answer is, maybe, for some limited use cases:
There is the fresh new pkg that does exactly this, and it looks promising.
There has been nexe for a while, it works great for some use cases (maybe yours). Native/compiled modules are still an issue however.
Electron might work for a full blown app with a significant user interface, but it is not light or compact.
You could always use browserify to concatenate and uglify all your code with the modules you use and then make an installer with something like NSIS to setup node and your script. Native modules would still be a problem however.
boundaries:
I have a Linux64 (Redhat 6.8) test-server here which I can access via FTP in our intranet. This server has no access to the internet.
I want to use an SVN command line client and Python with cx_Oracle and an oracle client on that machine
I don't have root access.
I don't have much idea of Linux
I thought I will start with the easiest thing which was SVN in my opinion:
My first guess was, that I could just download the binaries for SVN for Redhat 6 on my windows machine and copy them to the Linux machine using FTP.
But what I found here was "yum install subversion" (which does not work due to missing root and internet access) and a file "subversion_installer_1.9.sh" that I got from WANdisco (but which also needs root and internet access again).
Why is that so complicated? I come from a windows world and I am a little bit disappointed at the moment, because I always thought that stuff like this should work quite easy on LINUX (just copying binaries and you are good to go).
What do I overlook?
How would you do that?
You can "install" Subversion and Python and cx_Oracle without root access but since you are straying outside of the "normal" approach to things you will find it much more difficult than if you simply followed the "normal" approach. And the "normal" approach is to use a package manager (like yum) which requires root access. The Windows approach is simply different. There have been many arguments over which is "better" but I won't get into that here!
Installing something on Linux is as easy as copying binaries. The difficulty lies with getting the right binaries to copy. Unlike Windows where the system API (kernel32.dll/user32.dll/gdi32.dll) is extremely consistent and highly compatible between versions, Linux distributions have multiple system APIs (glibc, newlib, uclibc) and more frequent ABI breakage the n in libc.so.n changes.
When you download binaries from a repository hosted by your distribution maintainer, you know that they are built to use the same versions of the various dependencies as every other binary on your system. There's no such guarantee for binaries obtained from the developer, who may use a totally different distribution.
So the common thing for open source projects such as subversion is to obtain an archive of the source code from the developer, unpack it, run ./configure to customize the makefiles for the system libraries on your system, make to build binaries that use your distro's particular flavor of system libraries, and make install DESTDIR=~/somesoft to install in any directory you have write access to.
I don't know how to turn the question so that it can have a single response. Basically I own a static internet website (pure rest/json/javascript) that I need to be served, and I am looking for an http server where I could just put the files and have it up and working.
I am running on solaris with no administration rights, so I'd rather if it was easy to install with no compilation, so basically I think an http server written in java would perfectly fit.
I think Apache would have been a perfect choice, and it is already installed on solaris, but I don't have the administration privileges I would need to activate it.
Thanks you
Quick and dirty:
Wrap the static website in a WAR archive (I just unpackaged and repackaged the sample.war they provide as a demo for tomcat)
Download a version of tomcat appropriated for the installed version of java and deploy the war into it.
Not very elegant nor performant, but does the job. I am staying with this for the time being.
I am facing a strange problem, maybe somebody can point me to right direction.
I have an application that uses a shared library that I built back in the day, shared library is stored under /usr/lib/ folder. My application binary used to work OK with this set up. Yesterday I tried to install ORACLE-XE to my linux distro. Ran some scripts that set some environment variables. My installation failed and I had to uninstall ORACLE-XE.
When I came back to work today, I tried to run my binary just like I used to, but I've seen some errors about undefined symbol. Symbol name was related to the shared library that I used seamlessly for months. I have the same setup in other machines, I confirmed that application is still working there, so I copied application binary and shared library from other computers to the computer that I am working on, still no luck. It seemed to me that like shared library is not being loaded at all, I tried deleting the shared library and running the application one more time, I received the same error, right around the same time.
I think the oracle scripts might have mingled some of the environment variables, therefore shared library can not be loaded. I am not sure what to check next though, any suggestion would be appreciated.
ldd application-name helped me to identify where the shared library is being read from, it appears that there was another version of shared libary under /usr/local/lib, which was causing the issue.
have you struggled with Linux deployment before?
I need to deploy an application into a dedicated Linux box with no outside network access.
The configuration should be as simple as possible, robust for different configurations (missing libraries and build tools) and preferably automatic. Another difficulty I need to consider is that I need to connect to an Oracle database.
What would you recommend as the best way for deployment? I have some ideas, but not sure which is the best.
I can use Java
I will need to install JDK, and that solves mostly everything
Another big problem is that the code we presently have in Java is poorly written and slow.
I'm not sure if I need to install Instantclient to connect to Oracle under linux
I can use C (I do have the source code for a very well-written LGPL program)
And use dpkg to deploy
The Linux box is most likely a Ubuntu server, but I'm not sure which version is installed
I can't use apt-get, but I can copy all the packages I need
I know I can use dpkg -s to check which packages they are, but I'm really not sure if I might miss dependencies.
I guess I will need build-essentials and pcap or such
And use static linking
I configured it with ./configure LDFLAGS=-static with no errors and it works on my computer now
I have chroot into this directory and run it without problems, does this mean this is okay?
I really need to test this on a new Linux box to make sure
And use Statifier
I browsed stackoverflow and found this app, haven't tried it out yet.
Seems like people have used it with mixed success.
And create a build environment and make
I have no confidence that this is going to work
Using C leaves some problems
But the program is incomplete, I have to process this data, preferably not in C.
I have to install Instantclient, which is difficult to deploy
I can use Perl
I can't use CPAN
I have already downloaded the libraries, so maybe I could just copy them into the deployed machine, I am not sure how or whether this works
Perl is slow
I have to install Instantclient anyways
Please share your similar experience.
C with static linking solves a lot of the portability problems at the expense of a larger executable. To make sure that everything is truly getting statically linked and not secretly depending on any outside libraries, run ldd on your executable and make sure it isn't dynamically loading everything. Note that this won't be 100% portable amoung various linux machines because Oracle instantclient has some dependencies on kernel versions, but it should work on any reasonably new kernel.
Edit: If the box has LAN access and and just no internet access, why not run your own apt repository on the local network. You could even create a .deb for your application and put it on the same server, than on that machine you just need to execute apt-get myApplication and it will pull down your app and any noninstalled dependencies as well. Setting up an apt mirror is actually pretty easy and this would be pretty slick. If network access is missing alltogether, you can still create an install dvd that has all the debs including your app and set up apt-get to pull from there.