This article is about setting up the Comet implementation, Orbited.
This blog post will go over how to deploy Orbited and get the IRC chat example working along with common errors and problems encountered when first setting up Orbited. We will even go over the very common problem of trying to setup Orbited on a subdomain.
The first step is to run the Orbited server.
In your command line or SSH client, run the following command:
orbited
This should start up your orbited server. If it throws errors, take note of it.
If you encounter an error this error with Orbited:
ERROR orbited.start Aborting; Unknown user or group: 'getpwnam(): name not found: orbited'
The fix is to not run Orbited server under “root.” Instead, create a non-super user and run it under that account.
Once you get the server running, it’s time to edit the Orbited configuration file, orbited.cfg.
We’ll start with the [global] section.
Perhaps you don’t want to switch users everytime you want to run the server and you want to run it as root?
If that is the case, then add the following line under the [global] section:
user=USERNAME_GOES_HERE
Next time you run Orbited, it will automatically switch the user.
Now let’s move on to the [listen] section.
You may see something along these lines:
[listen]
http://:8000
This denotes that Orbited will listen for HTTP on port 8000. If you are running on a subdomain, you need to change it to the following:
[listen]
http://sub.domain.com:8000
The next part is very important. It specifies access permissions. If you don’t setup the permissions, Orbited won’t be able to connect – period. I’m referring to the [access] section.
If you left the [listen] section to http://:8000, then your [access] section should look like:
[access]
localhost:8000 -> irc.freenode.net:6667
If you have any other lines in the [access] section, remove it (as this is the only line necessary for IRC)
Notice we are only setting up permissions to the Freenode server on port 6667. Feel free to change the server and port as you desire. If using “localhost:8000″ is throwing errors, try “127.0.0.1:8000″
However, if you are on a subdomain, it needs to look like this:
[access]
sub.domain.com:8000 -> irc.freenode.net:6667
Note: Do NOT use “http://” in [access] section if you are specifying a subdomain.
Now, save your config file as orbited.cfg and upload it to the /etc/ folder.
Run Orbited via SSH or command line by typing:
orbited
If it is running correctly, it will say it is listening on http@8000.
Once the server is up, we want to test the IRC chat client.
Do not navigate to the IRC chat client from your public_html folder or whichever folder is used to serve HTML pages to the public. Instead, go directly to:
http://yourdomain:8000/static/
For the domain above, you can use your domain, subdomain, localhost, 127.0.0.1, IP address, or whichever is necessary for this particular situation. If you uploaded Orbited to your public_html folder already, and you uploaded it to a subfolder instead of main folder, you should still use:
http://yourdomain:8000/static/
Do not add any folder names or file names. The above URL should return a web page if everything is setup properly. The web page should give you a files and folders listing. Navigate to the “demos” folder and then the “chat” folder.
Login to the IRC chat client and make sure that it works.
Sometimes, when you try to login to the IRC chat client, it will be blank right after you input the username and nothing will happen even if no Javascript errors are thrown. In this case, check your Orbited server. If you see an error like this:
"09/02/08 10:44:36:930 WARN orbited.proxy.ProxyIncomingProtocol Unauthorized connect from '127.0.0.1':2812 to 'irc.freenode.net':6667"
This means your permissions were not setup properly. In this case, go back to editing your config file at orbited.cfg and go to the [access] section. Change the access section so it reads:
[access]
* -> irc.freenode.net
The line under [access] is a very general line to debug Orbited. It involves using a wildcard (*) and allows connections from anywhere and any port on your server to irc.freenode.net (regardless of the port number used to connect to irc.freenode.net)
Obviously, this is not very secure, but you should try this setup to debug.
Once you edited the config file, exit the Orbited process, upload orbited.cfg to /etc/ and start the Orbited server process back up again.
Now empty your browser cache and go back to the IRC chat. It should now be working.
Once everything is working properly, you can now start testing on your public_html (or equivalent) directory to see if everything is working live.
Please make sure you edit the chat’s index.html file so it loads the Javascript files from the proper directory!
If you are on a subdomain, it may not work from public_html directory. In this case, you need to edit the chat’s index.html file so it includes the following line right below the <head> tag:
<script>document.domain = document.domain</script>
This is only if you are on a subdomain because it prevents problems with cross-site scripting (XSS) prevention mechanisms built into modern browsers.
If it’s still not working, search the chat’s index.html file and you should see a<script src=”"> tag which loads Orbited.js like this:
<script src=”Orbited.js”></script>
Change the <script src=”"> tag so it reads something along the lines of:
<script src=”http://sub.domain.com:8000/static/Orbited.js”></script>
Replace the part in bold with localhost, your domain, your subdomain, 127.0.0.1, your IP address, or the relevant address. Again, do not add any foldernames or filenames to the above.
Most of the issues discussed involved subdomains and permissions — which are the common problems encountered when first installing Orbited.
If you go through all of our Comet/Orbited tutorials, you should be able to successfully install Orbited and get your Comet applications running!
Categories: Tech




