Thursday, January 2, 2014

Locally mirroring wiki and api docs of ROS under dropbox folder

Happy new year ROS world!

While recently I've been travelling so often like a sales person in a global company (that I'm not at all), I realized I could often appreciate if I had an access to ros web pages especially wiki and api docs even while I'm offline, and as a new mirroring method was just announced in a timely fashion for me, I built local ros.org mirror server. And also because I use multiple machines for development depending on my situation, it'd be even nicer if the data is synchronized, and I put it on dropbox folder. One down for new year's resolutions already.

Since I got stuck a little at a general web server setting, I thought I post how I did for docs.ros.org/hydro and wiki.ros.org.

1. If you have no problem in storing all the data under /var/www, you just follow these ros wiki to sync the data from ros.org to your computer. For wiki.ros.org, for docs.ros.org. Then as long as your web server (assuming apache2 on Ubuntu) is running, you can access them via http://localhost/wiki.ros.org etc.

Since I wanted to store the data under dropbox folder, I needed the following tweaks:

2. Create a folder under your user directory, OUTSIDE of dropbox folder, where you're okay to share with OS' user or group www-data that apache2 is run by. Store all the wiki data there. What I do is to create `ros.org` folder first, then placed 2 directories into it, namely the structure looks like:
     ros.org
     |- docs.ros.org
     |- wiki.ros.org
3. Change the owner or group of the folders wiki.ros.org and docs.ros.org to www-data (only doing so for the group should do the trick).

4. Create a symbolic %YOUR_DROPBOX_DIR%/ros.org to the one created above, so that dropbox synchronizes the data (AFAIK, dropbox on Ubuntu does trace up the symbolic links and sync data there. I'm not entirely sure yet -- now it's still being syncing).

5. Create a symbolic /var/www/ros.org to the one created in 2.

6. Add following to /etc/apache2/mods-available/alias.conf

    # 1/2/2014 For ros.org local mirror.
    Alias /ros.org "/home/freshpastacooker/data/ros.org"
    <Directory "/var/www/ros.org">
        Options FollowSymlinks
    </Directory>

7. Restart apache2 and now you can access those html pages by http://localhost/ros.org/docs.ros.org, http://localhost/ros.org/wiki.ros.org, respectively.

This may seem a bit tricky -- the key is apache2 CANNOT refer to the symbolic link where ALL OF THE PARENT FOLDERS of the target is visible to its user, `www-data`.

Ok, now the boarding has begun for another flight. I'd appreciate any feedback!

No comments:

Post a Comment