Arc Forumnew | comments | leaders | submitlogin
hosting for arc web app
15 points by antiismist 3453 days ago | 36 comments
So, I am going to be deploying my arc-based webapp pretty soon. Anyone deploy an arc app yet? Can anyone give a recommendation for shared hosting?

I am thinking about slicehost or linode...cost is not so much a factor as compared to setup hassles.



6 points by antiismist 3450 days ago | link

Thanks for the suggestions. So I went with Slicehost.com

The setup so far:

apt-get install mzscheme

use wget to grab arc2

run (nsv 5555) - got the famous date error. So now the next task on my checklist is learning how to use git so I can get the date patch via anarki...

-----

9 points by nex3 3450 days ago | link

  apt-get install git
  git clone git://nex-3.com/arc-wiki.git
  cd arc-wiki
And optionally, if you only want the patches and no other improvements,

  git branch stable origin/stable
  git checkout stable

-----

4 points by antiismist 3449 days ago | link

worked like a champ, thanks!

minor point, I used

apt-get install git-core

(because just "git" didn't seem to work)

-----

3 points by nex3 3449 days ago | link

Oh, right, sorry. The "git" package is something else (GNU something tools, I think).

-----

7 points by projectileboy 3453 days ago | link

Slicehost worked just fine for me, running Ubuntu 7 and MzScheme 360.

-----

2 points by tjr 3453 days ago | link

I'm using OpenHosting, and now running an instance of this Arc News software, along with several small Apache-based sites.

OpenHosting was the best VPS I could find when I signed up for it, but there appear to be better deals available now. If I were doing it again (or bothered to move) I'd probably go with Slicehost.

-----

2 points by chriszf 3421 days ago | link

Okay, forgive me if I'm retarded, but it's been a while since I've done any lisp and reading someone's source always takes a while.

I was trying to go through news.arc and figure out how it deals with memory, and as best I can tell, it doesn't seem to. It looks like it just loads some n most recent stories/posts on startup, and accumulates new ones in memory while simultaneously saving them.

This seems to me that if left running, the app will eventually suck up memory and need to be restarted. Is this the case, or did I miss the line in the implementation where it flushes old stories out?

-----

2 points by almkglor 3421 days ago | link

From a very cursory review of the code: 'newscache looks like it's related to releasing data.

-----

1 point by chriszf 3421 days ago | link

I'm not convinced of that. It appears to be a macro for building a cache of various things with a timeout. It doesn't appear to touch the stories* table.

On an unrelated note, can anyone explain to me the memory model/threading mechanism interaction? It seemed at first that it was a single-threaded server, but after looking at srv.arc, it's clear that multiple threads are being spawned for the server process, yet stories, profs, and votes* aren't don't seem to be rebuilt from permanent storage, which implies the tables can be shared between processes. Which, I guess, goes back to my original question. So this isn't unrelated at all.

-----

1 point by almkglor 3421 days ago | link

Hmm. After another cursory glance, yes, this appears about correct.

As for memory model: global variables are always shared between threads. The underlying implementation automatically locks tables when mutating them AFAIK.

As for suck up memory: I suppose the thinking is that a single post may very well take less than half a kilobyte, and modern computers have gigabytes of memory, so...

-----

1 point by chriszf 3421 days ago | link

That was my thought too. I suppose I may have been overestimating the traffic to HN, or the size of the server or both. I guess I wanted a definitive answer about having to restart the server periodically. That seems to be the case, but it doesn't seem to be too bad.

This seems to be a pretty good model for a moderate-traffic app with data that gets modified infrequently. I don't think I'm quite ready to arc just for that, but I was wondering if this is a sensible approach in any other language, say, python? Any thoughts?

-----

1 point by almkglor 3421 days ago | link

Well, Arc is still starting. In more-established languages, such approaches are unnecessary: there are libraries which will handle caching of data etc. properly, releasing unused memory for garbage collection once they are no longer accessed for some time, and rebuilding objects from permanent store if they have been disposed. In Arc it's still not yet implemented, so that approach works fine.

That said you might be interested in the so-called "Anarki" repository, which contains some of the elements I and others have built so that the server works a little better. For example: being able to serve files in subdirectories of your Arc installation, instead of the Arc installation; table-like data structures for caching data, or for persistent disk-based data; a slightly more extensible language, with some of the more common methods of extension already prepackaged in macros; etc.

-----

1 point by chriszf 3420 days ago | link

Can you give an example of such libraries, off the top of your head?

I am basically interested in small multi-user applications that don't sit on top of relational databases. There really isn't too much information out there on the matter. Everyone seem to want to use a database, even for the simplest things. I suppose that given the pedigree of arc, this flat file storage business seems sensible enough.

Anyway, thanks for the pointer to anarki. I'll take a look at it.

-----

2 points by almkglor 3420 days ago | link

LOL, no. ^^ I don't program web apps much.

For that matter, most languages prefer db's because of the fact that file storage operations don't have, umm, structure.

In fact the canonical Arc web app, news.arc, has a list structure to store in the "flat" file. Thus for simple apps where entities only have a few not very complex fields, textual representations of lists seem to be enough.

In other languages however their "array" syntax (which is approximately what lists are in Arc) is usually not readable by a built-in function a la lisp 'read. Also, their array syntax is usually not the center of attention, unlike in Lisp where the code syntax is itself the "array" syntax.

-----

3 points by CatDancer 3453 days ago | link

I've been a happy customer of linode for several years and I recommend them.

-----

1 point by shader 3144 days ago | link

Sorry to dredge up an old post, but I was wondering pretty much the same thing. Is it possible to use arc on a shared host? Has anyone here done so? Python is already supported by many such hosts, and it doesn't seem like it should be too hard to do the same with arc.

-----

1 point by CatDancer 3143 days ago | link

What part of your question hasn't already been answered in the earlier comments?

-----

1 point by shader 3143 days ago | link

All of the previous comments presumed virtual private servers, as far as I could tell. I am basically wondering if arc (or another lisp) could be run on a host such as DreamHost via fastcgi, or a similar method. Since python and ruby are run on DreamHost this way, it seems feasible, and I was wondering if anyone else had done this with arc or another lisp.

-----

1 point by cchooper 3143 days ago | link

Poking around the DreamHost support wiki and terms of service, I can't see anything stopping you. You can run an Arc interpreter in the background, so long as it doesn't eat too many resources, and I can't see anything stopping you from forwarding requests to it.

However, it will not be officially supported in the same way that Ruby and Python are, so you'll be on your own when it comes to fixing problems. It might be better to use their private hosting service so that they don't complain about your Arc process (which they may do if a bug causes it to behave badly). Although this means it runs on a private virtual server, you still get all the same support and software as with the shared service.

-----

1 point by CatDancer 3142 days ago | link

Another option is if your provider will forward web requests that come in on the standard HTTP port 80 for your domain to your Arc process listening on a port such as 8080.

For example, here's my Apache configuration:

  <VirtualHost *:80>
    ServerName desiremenu.net
    ProxyPass / http://localhost:9002/
  </VirtualHost>
Arc runs and listens on port 9002 (serve 9002). Web requests that come in to http://desiremenu.net/ are forwarded by Apache to port 9002.

This doesn't need any additional code or implementation in Arc, since srv.arc already implements a web server.

-----

1 point by shader 3141 days ago | link

How well does that hold up under load? I.e. is it fast enough to run on a shared host?

Also, has anyone here tried any of the other lisp web frameworks, such as webolcks, ucw or plt? How do you think they compare to arc's?

-----

1 point by CatDancer 3140 days ago | link

is it fast enough to run on a shared host?

I would assume so. I've used Apache's ProxyPass frequently and haven't had a problem. There's no technical reason that I know of that it would be either faster or slower than fastcgi. In both cases Apache is passing on the request to a persistent process. I haven't measured it though.

-----

1 point by CatDancer 3143 days ago | link

You'd need to find a provider who allowed you to install executables, so that you could install MzScheme. Then, I haven't heard that anyone has implemented the fastcgi protocol for Arc, so you'd need to implement that.

-----

1 point by shader 3143 days ago | link

How hard would it be to pull the fcgi interface up from mzscheme?

-----

1 point by CatDancer 3142 days ago | link

I haven't tried it, so I don't know, but in general I've found it easy to call MzScheme code from inside of Arc.

You can add xdef's to ac.scm; Anarki has a $ macro to call into MzScheme if you use Anarki; and I describe my favorite way to call into MzScheme here: http://arclanguage.org/item?id=8719

-----

3 points by offby1 3453 days ago | link

Another happy linode customer

-----

3 points by dag 3453 days ago | link

I'm using a Linode 360 running Debian 4 which works well.

-----

1 point by listic 3452 days ago | link

I see that minivds.com have low prices (starting at $5,95 / month) for FreeBSD-based VDS. Also they offer ~1 GB of preinstalled software that doesn't count towards your quota. The information is from their site, not my personal experience. Actually I was going to use it myself, but haven't yet. What do you think of it ?

-----

2 points by marcos 3447 days ago | link

actually, i must be dense, but when y'll run arc instances are you doing something like

  mzscheme -m -f as.scm
  (nsv 8080)
or are you running it differently so that you can pop it into the background? i get lots of timeout errors from doing this... thanks.

-----

4 points by sacado 3447 days ago | link

What do you mean by "pop into the background" ? There are 2 ways to achieve this :

  (thread (nsv 8080))
This one gets you back to the REPL, so that you can maintain your app as it is running.

  mzscheme -m -f as.scm < script.arc &
This one (under Unix) runs the script and gives you back to the prompt, while your server is running.

What kind of errors do you get ?

-----

1 point by antiismist 3445 days ago | link

Is there a standard graceful way of stopping a background process?

I could: launch nsv as a thread in the background, then fg it back, then use (quit) in the repl. But is there a better way to do this? Does (quit) shut down the server gracefully?

-----

3 points by almkglor 3445 days ago | link

(quit) shuts down gracefully AFAIK. If you're not confident of it, use (= quitsrv* t) and make one request from the server.

-----

1 point by marcos 3447 days ago | link

upon further reading through the forum, i figured out that the timeouts were a side-effect of the 'date problem' but because i hadn't been quick on the uptake, i had no idea that was what i was even looking for.

moving to anarki/arc-wiki stable fixed that. thanks for putting up with me, everyone!! :)

-----

1 point by marcos 3447 days ago | link

you are my hero, i hadn't seen the thread procedure documented in the tutorial.

the problem manifests itself as either 502 errors (served via mod_proxy_balancer) or "server dropped the connection" errors, but the thread business helps immensely.

-----

1 point by antiismist 3446 days ago | link

As far as I know there are three ways to run nsv in the "background":

1. via (thread...)

2. via &

3. via a detatched screen

(I like to use this because my server is remote so I can set up something, detatch, disconnect, and log back in later and reattach)

So what I use is a detatched screen and (thread ...)

-----

2 points by antiismist 3453 days ago | link

Thanks for the answers!

-----