Arc Forumnew | comments | leaders | submitlogin
Need for a zero-to-web-apps-running install howto for OS X and CentOS: BIND, MzScheme, Arc
1 point by niels_olson 5885 days ago | 9 comments
Having played a bit with Logo, Basic, and Pascal in the 80s and early 90s and starting again with Python earlier this year, I'm trying to make a commitment to learn Arc as a counterpoint to Python and I'm finding a steep learning curve. Which is motivating in its own way, but points up the need for some server basics. I run a number of websites and managed to get a CentOS server running on my own, but as yet haven't had to grapple with BIND and the only language I ever installed without a Linux package manager was Python on the same Mac, but that was some time ago. I can certainly run MzScheme and Arc from local directories, but I'm trying to get the demo web apps to work in localhost and on a running-connected-to-the-tubes-server and, as usual, running into challenges I haven't faced before. As usual, I'll probably figure it out and, if not for this post, would never bother to note the need for such a howto, let alone actually write up a howto. If anyone else wants to beat me to it, please do. Preferably, before I figure it out ;-)


2 points by almkglor 5885 days ago | link

Much of the base system of Arc expects some Unixisms. In fact, much of the base system of PG's original ArcN expects a mostly BSDisms, and it's really the Anarki fork which supports mostly Linux.

As an example, much of the code assumes that the path separator character is "/", but I gather from mzscheme documentation that Mac OS uses ":". Also, bits and pieces of the Arc system use /dev/urandom.

So mostly I suspect the problems you encounter(ed) are from Arc's assumption of Unix-likeness which might not be available on OS X (not sure however; I don't have access to a real Mac)

Edit: Oh and yes: the first thing you want to do is switch to Anarki, which is more likely to work on a random, non-PG system.

-----

1 point by niels_olson 5885 days ago | link

OS X is based on BSD. As for the path thing, wow, that threw me. Not sure what that might apply to. Here's are my PATH entries on a SuSE box and my Macbook, respectively. They're both POSIX compliant.

niels@suse:~> echo $PATH /home/niels/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:.:/home/niels/myscripts:/myscripts

osx:~ niels$ echo $PATH /Users/niels/Desktop/LearningPython/arc2:/Users/niels/Desktop/LearningPython/MzSchemeV352/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin

I guess, for starters, I need to figure out how to set up BIND to route news.localhost to a local directory, and figure out which directories the various bits of MzScheme and Arc should be applied to. My biggest frustation right now is figuring out the syntax for BIND.

-----

1 point by almkglor 5885 days ago | link

I got that bit about Mac: http://download.plt-scheme.org/doc/103p1/html/mzscheme/node1... . However, the newer PLT docs here: http://docs.plt-scheme.org/reference/Manipulating_Paths.html say that apparently Mac OS X is now quite sensible.

Windows internally implicitly supports / as an alias of \.

Note that Arc provides its own http-server which is not very directory-based (rather, something like http://example.com/login would be defined with a (defop login ....) form in the running Arc process), so I'm not sure why you're routing to a directory.

-----

3 points by absz 5885 days ago | link

The deal with path separators has to do with the difference between the classic Mac OS (9 and lower) and Mac OS X. Classic Macs used their own path system, which used :s as the path separator (e.g., ":Macintosh HD:Documents:Arc:tut.txt"). When the switch to OS X came, suddenly everything was based on Unix, so file paths became sane (e.g., "/Users/username/Documents/Arc/tut.txt" or even "~/Documents/Arc/tut.txt"). Nevertheless, in the name of backwards compatibility, many things still display paths in the old format, the GUI pretends that :s in file names are actually /s, and AppleScript deals natively with old-style filenames.

In a nutshell: OS X sane, Classic Macs crazy.

-----

1 point by niels_olson 5884 days ago | link

Re Anarki: yes, I've found arc2 doesn't work out of the box on CentOS 5, and my repos are botched (something to do with installing PHP 5 during initial install, I think, was what forced me to change something in the repos), so I need to fix the repos to install Git so then I can install Anarki.

I looked for git in the CentOS repos for hours and never found it. Yum swore up and down it couldn't find git. So I compiled it using these directions: http://el-studio.com/article/building-git-on-centos-5

-----

1 point by niels_olson 5884 days ago | link

Okay, for OS X (which is what pg develops on)

1. Download MzScheme version 352 to some directory

2. add the path for that directory to your .profile ($ vim ~/.profile)

    # Setting PATH for MzScheme, which Arc depends on

    # The original version is saved in .profile.mzscheme

    PATH="/Users/niels/Desktop/LearningPython/MzSchemeV352/bin:${PATH}"

    export PATH
3. Download and untar Arc to some directory

4. add the path for that directory to your .profile:

    # Setting PATH for Arc2

    # The original version is saved in .profile.arc2

    PATH="/Users/niels/Desktop/LearningPython/arc2:${PATH}"

    export PATH
5. navigate to your arc directory

6. type mzscheme -m -f as.scm

7. at the arc> prompt, type (nsv)

8. point your browser to localhost:8080

9. Be advised, it has its own web server which makes the site immediately also live, regardless of the web sharing settings in System Preferences: just find your IP address (eg, xx.xx.xx.xx) and point your browser to xx.xx.xx.xx:8080. In fact, you can continue to run apache on other ports. Note: you can't run news and blog at the same time out-of-the-box. Thinking out loud, it looks like the server is a child of the web app, so you could make a copy of the srv.arc file (SrvForBlog.arc) and modify blog.arc and SrvForBlog.arc to serve out of another port.

Notes on geography:

- <path to arc>/arc/cooks: the list of cooks in the kitchen

- <path to arc>/arc/hpw: list of hashed passwords for all users

- <path to arc>/arc/logs/news-yyyy-mm-dd: log of news activity for the day

- <path to arc>/arc/logs/srv-yyyy-mm-dd: log of server activity for the day

- <path to arc>/arc/news/topstories: list of top stories in news, by serial number

- <path to arc>/arc/news/profile/: contains a file on each user

- <path to arc>/arc/news/story/: contains a file for each story

- <path to arc>/arc/news/vote/: contains a file for each user's voting.

-----

2 points by almkglor 5884 days ago | link

<path to arc>/arc/cooks : is a set of user->cookie mappings (in assoclist form)

<path to arc>/arc/admins : admin users (one username per line)

-----

1 point by niels_olson 5884 days ago | link

ah, thanks.

-----

1 point by niels_olson 5884 days ago | link

If you're like me and playing with this on a remote server while sitting in a coffee shop, you may want to keep your experiment running when you leave. Great little tutorial here on backgrounding tasks, nohup, and screen:

http://www.xaprb.com/blog/2008/08/01/how-to-leave-a-program-...

-----