Arc Forumnew | comments | leaders | submitlogin
Ask Arc: Running news.arc on a custom IP
4 points by acow2 3776 days ago | 2 comments
I am trying to get news.arc running on Redhat's Openshift. (DIY Cartridge using Raycine's instructions to get racket running)

Here are the steps that I have followed

1. Get the DIY cartridge running using raycine's instructions from here - https://github.com/RayRacine/rackos/wiki/Quick-Start

2. Get anarki's news.arc from here https://github.com/arclanguage/anarki/

On deploying the code, racket is installed, however I don't know how to pass arc prompt arguments. So, I ssh into the openshift server and do the following $racket -f as.scm arc>(load "lib/news.arc") arc>(nsv) Error: "tcp-listen: listen failed\n port number: 8080\n system error: Permission denied; errno=13"

I found this thread - http://arclanguage.com/item?id=7731 which has a similar error.

Openshift allows usage of 8080 port which news.arc uses by default. However, Openshift requires using their internal IP ($OPENSHIFT_DIY_IP).

I tried finding a way to specify an ip for tcp-listen. (Racket's tcp-listen documentation is here - http://docs.racket-lang.org/reference/tcp.html)

Here are some ?relevant lines from ac.scm (https://github.com/arclanguage/anarki/blob/master/ac.scm)

  (xdef open-socket  (lambda (num) (tcp-listen num 50 #t)))

  (xdef socket-connect (lambda (host port)
                       (ar-init-socket
                         (lambda () (tcp-connect host port)))))

  (xdef ssl-connect (lambda (host port)
                    (ar-init-socket
                      (lambda () (ssl-connect host port)))))
lang.arc has these lines, however I doubt lib/lang.arc is called when I load news.arc (I tried replacing the ip with the value of $OPENSHIFT_DIY_IP but same result)

reactor.connectTCP("localhost", «lang-control-port», ControlClientFactory()) reactor.listenTCP(«lang-listen-port!python», site, interface='127.0.0.1')

Can somebody suggest a solution? How do I specify a hostname for tcp-listen?



2 points by akkartik 3775 days ago | link

Hmm, I have no experience with openshift, and I've never heard of a server needing to know its own IP address. Just goes to show how little I know of networking. Can you point us at the relevant openshift documentation?

If it is indeed the IP address, it sounds like you're most of the way there. Did you try changing the definition of open-socket that you found, adding a fourth argument with the right IP address?

-----

2 points by rocketnia 3775 days ago | link

"Did you try changing the definition of open-socket that you found, adding a fourth argument with the right IP address?"

I think that's exactly how to make this work (albeit hackishly). Here's the code for that, but note that I haven't actually tried this out:

  (xdef open-socket
    (lambda (num)
      (tcp-listen num 50 #t (getenv "OPENSHIFT_DIY_IP"))))
I've done some OpenShift experiments using a Node.js cartridge; I'm not engrossed enough for a DIY cartridge yet. :) It's nice as a freemium host for long-running servers, so getting news.arc to run on it would be pretty exciting.

---

"...and I've never heard of a server needing to know its own IP address."

This isn't its own IP address; just looking at the way this needs to be used, it's the a IP address of a reverse proxy. I assume this is so the OpenShift cloud can easily hibernate and migrate these hosted servers while it does its own load balancing and maintenance.

-----