Arc Forumnew | comments | leaders | submitlogin
1 point by tvvocold 3605 days ago | link | parent

just fix it by set the env....so i run the bash,,,and now i still cant sign up or login...why?miss something like sql?


2 points by shader 3605 days ago | link

Ok, I finished the fix. You need to do a few things in order to get it working:

1) Update the anarki installation on openshift:

  rhc ssh <app>
  cd ${OPENSHIFT_DATA_DIR}arc
  git pull
2) Merge in the latest changes to my arc-openshift repo, which contains the tmpdir* fix.

3) Push to openshift, and wait ~20 seconds for it to reload.

You should now be able to register and create new posts.

-----

2 points by tvvocold 3604 days ago | link

thx,bro,u really rock...so i rebuild a new site http://news-tvvocold.rhcloud.com and i can sign up and login in...but i can't submit still...why that? follew ur instructions i cant push (stuck at 5th step)so i use this

  ##git remote add upstream -m master git://github.com/shader/arc-openshift.git
  ##git pull -s recursive -X theirs upstream master
Am i doing it wrong or miss something?

when i try

  arc> (nsv)
  rm: cannot remove"arc/news/story/*.tmp": No such file or directory
  load items: 
  ranking stories.
  tcp-listen: listen failed
    port number: 8080
    system error: Permission denied; errno=13
    context...:
     zz
     /var/lib/openshift/53755de6500446c100000b1a/app-root/data/arc/ac.scm:1227:4
and i repeat again :arc> (nsv) rm: cannot remove"arc/news/story/.tmp": No such file or directory load items: ranking stories. user break context...: /var/lib/openshift/53755de6500446c100000b1a/app-root/data/arc/ac.scm:1084:20 recur recur user break context...: /var/lib/openshift/53755de6500446c100000b1a/app-root/data/arc/ac.scm:1084:20 recur recur tcp-listen: listen failed port number: 8080 system error: Permission denied; errno=13 context...: zz /var/lib/openshift/53755de6500446c100000b1a/app-root/data/arc/ac.scm:1227:4

if u update the full instructions that will be great and grateful,,,thx very much! (add this will be helpful

  ##export PATH=$PATH:/var/lib/openshift//app-root/data/racket-6.0.1/bin:$PATH
)

-----

4 points by shader 3604 days ago | link

I'm not sure why you can't submit. I tested it on mine, and submission worked for me once I fixed the login issue.

For the git issues, I found a mistake in the instructions. The 'add remote' line should be:

  git remote add arc-openshift git://github.com/shader/arc-openshift.git
Since I copied it from RayRacine's rackos, it had accidentally said to add the remote as 'rackos', which makes the following lines incorrect. Maybe that wasn't your issue though. Any more details?

As for your repl test, you are directly calling '(nsv), which defaults to binding on port 8080 for all ips, which is against the OpenShift policy. What you want instead is:

  (nsv '("127.8.109.xxx" 8080))
Where 127... is your OPENSHIFT_DIY_IP. You can see how it works if you look in main.arc. You may need to correct your current directory as well.

Another alternative would be to just load main.arc from the terminal, which would automatically start the server exactly as the post-deploy script does, but in a way that lets you see all of the errors:

  (thread:load "../repo/main.arc")
Of course, you'll have to change the path depending on where you're running the arc interpreter from.

-----

1 point by tvvocold 3604 days ago | link

thank you very much.so i dicide to build a new site follow ur instructions. here's what i got...

  arc> (thread:load "../../repo/main.arc")
  #<thread>
  arc> rm: cannot remove"arc/news/story/*.tmp": No such file or directory load items;
  load items: 
  ranking stories.
  ready to serve port (127.10.233.1 8080)
  tcp-write: error writing
    system error: Broken pipe; errno=32
    context...:
     /var/lib/openshift/5375a15d5973ca41a30002b1/app-root/data/arc/ac.scm:945:0: printwith
      map1
      map1
      pr
      handle-request-thread
      handle-request-thread
  tcp-write: error writing
    system error: Broken pipe; errno=32
    context...:
     /var/lib/openshift/5375a15d5973ca41a30002b1/app-root/data/racket-6.0.1/collects/racket/private/map.rkt:26:19: loop
     /var/lib/openshift/5375a15d5973ca41a30002b1/app-root/data/arc/ac.scm:1479:0: ar-close
      handle-request-thread
  tcp-write: error writing
    system error: Broken pipe; errno=32
    context...:
     /var/lib/openshift/5375a15d5973ca41a30002b1/app-root/data/racket-6.0.1/collects/racket/private/map.rkt:26:19: loop
     /var/lib/openshift/5375a15d5973ca41a30002b1/app-root/data/arc/ac.scm:1479:0: ar-close
      th1
  tcp-write: error writing
    system error: Broken pipe; errno=32
    context...:
     /var/lib/openshift/5375a15d5973ca41a30002b1/app-root/data/arc/ac.scm:945:0: printwith
      map1
      map1
      pr
      handle-request-thread
      handle-request-thread
  tcp-write: error writing
    system error: Broken pipe; errno=32
    context...:
*----------------

that's what i got while i sign and submit.and when i closed the terminal the site shutdown too...503...

------that's what i do after followed by ur 8 step instructions in http://new-tvvocold.rhcloud.com/...and when i try my way in http://news-tvvocold.rhcloud.com,by use

  ##git remote add upstream -m master git://github.com/shader/arc-openshift.git
  ##git pull -s recursive -X theirs upstream master
i got it done....and i check ur and my site find that both of us cant submit a simple url like(www.google.com but http://google.com works) with a title ,but only can submit a textwith a title...that's a new problem...if u could tell me what is the right step after the 8step as ur instructions as well.that will be great!---best wishes!

-----

2 points by shader 3604 days ago | link

Did you perhaps get a 'Try again' message?

I tried on my site with the url "http://google.com, and that worked. However, doing just "google.com" does not, so it's apparently filtering for fully qualified urls.

As for your error message when run from the command line... I get the same "rm: cannot remove..." message, followed by "load items" and "ready to serve port..." all of which are correct. The only real error is after that part, but I'm not sure why you're getting it. That error looks like something that might happen on a timeout or broken connection with the client.

What were the results on the client side? Did you get a blank page?

-----

2 points by tvvocold 3604 days ago | link

i set it up http://xmeetu.tk welcome to visit!

but i try to echo “admin” > arc/admins ,and admin looks doesn't like admin...i cant delete other's post...

-----

3 points by shader 3604 days ago | link

It looks like you have to restart the app server in order to get it to reload the user information. If you have repl access though, you can just run (load-userinfo)

I do think that we need a way to connect to the repl of the running service, as well as update the code without requiring a full restart, as that takes >20s most of the time.

-----

2 points by tvvocold 3604 days ago | link

thx.but how to arc>? i stop the app ,cd arc, echo “admin” > arc/admins,,,arc> (load-userinfo) ,,,,and arc> (load "lib/news.arc"),,,rhc app-start news...what wrong?still cant find admins privilege in my page.

-----

3 points by shader 3603 days ago | link

You should only have to restart it once. Calling 'load-userinfo from the repl is redundant, unless you want to check the value of the admins* table to see if it worked or not.

Which arc directory are you putting it in? There's the one that is the anarki installation under app-root/data, and the other which stores web app data in app-root/repo. You need to put the admins file in the app-root/repo/arc directory, or it won't be found by the app server.

That's probably not the right place to keep it, but I haven't bothered to redirect all of the arc server directories, so that's where it goes for now.

-----

1 point by tvvocold 3603 days ago | link

done.thx ..u really rock!bro!can i know ur name or google+?

-----

2 points by tvvocold 3603 days ago | link

btw,where an i change the logo and copyright?

-----

2 points by shader 3603 days ago | link

You can change the images used by replacing them in the app-root/repo/static directory.

I'm not sure where the copyright message you're referring to is. To replace it, you'd have to figure out where in the anarki code it's being generated, and override it in main.arc.

-----

2 points by tvvocold 3602 days ago | link

what does main.arc do and news.arc do?

-----

3 points by shader 3602 days ago | link

news.arc is one of the libraries that comes with arc, and is a branch of the source for Hacker News and the Arc Forum. It defines all of the functions related specifically to the news site, and is what allows you to run a clone of the forum. It's located in the lib folder of the anarki repo.

main.arc is the launch script I included in my arc-openshift repository. It just sets a few variables, and then launches the news server with the right parameters. It's located in the root directory of the arc-openshift repo.

Other files of interest are the arc libraries srv.arc and app.arc. srv.arc sets up a web server, and app.arc adds extra utilities for things like user management, etc.

-----

3 points by tvvocold 3602 days ago | link

and what type of the database does arc use? and How can I prevent SQL-injection in arc?

-----

2 points by rocketnia 3602 days ago | link

The news.arc code writes to files. It doesn't use an SQL database.

---

Even without SQL, code injection is something to worry about. The Arc codebase is a breeding ground for exactly this kind of issue, since it rarely does string escaping. Let's see...

HTML injection (XSS attacks): This is the kind of injection news.arc primarily needs to worry about. Almost every string it passes around is used directly as an HTML code snippet. Fortunately, every user input is sanitized thanks to the form-generating utilities in app.arc.

Shell injection: Make sure that any directory paths passed to (ensure-dir ...) are already shell-escaped. (Arc also invokes the shell in a few other places, but those don't need any extra escaping.)

Format string injection: Be careful about file paths passed to (tofile ...). Everything after the last slash must be a valid 0-argument format string. The format string syntax is described at http://docs.racket-lang.org/reference/Writing.html.

Arc injection: The prompt.arc webapp is explicitly designed to let admin users evaluate their own Arc code on the server. If an attacker gained access to this page, it would be worse than any other kind of code injection. Because of this, I don't recommend running prompt.arc on a production site. (If it can't be helped, I recommend at least using HTTPS so admin login credentials and commands can't be intercepted by a man-in-the-middle attack.)

-----

1 point by akkartik 3602 days ago | link

I wrote about the database thing a while ago: http://arclanguage.org/item?id=17629 (you might need to click parent to see the question)

Edit: ah, didn't realize I was responding to you there!

-----

3 points by shader 3601 days ago | link

Yeah, that's something I'm trying to think about with the current project that I'm working on. Part of why I brought up mongodb support. Maybe something like datomic would be better.

Starting with simple files is actually really convenient and takes very little effort. Only fixing things that need fixing is a good way to make progress quickly, but it is a little disconcerting not to have many options to switch to.

Maybe building a simple arc-based database would be a good idea, but that also distracts from solving the actual problems I'm working on. Which did not initially include making a new database, as much fun as that would be.

I was working on a simple git-based data storage system for arc as part of my 'metagame' project. Not exactly designed for multi-server use though.

-----