Hey guys, sorry about the title, really did not know what to say there but the question is that I have a cluster setup with 7 nodes one of which is the load balancer. I am trying to setup a blogging site that will spread the CMS and sync all configurations to all nodes. I can't do this with rsync (probably) because I would have to sync each and every single directory that uses the cms which is simply very hectic. I am willing to do this if I knew which directories to do this to but another problem is that I can't figure out how to sync a folder from one node to another on the same local area network (home based web server of course).
So far, I have tested and I can sync files to a folder on a remote local host, can't do folder though.
If I had a cms like pagekit, pyplate or ghost how does one do this... How do I set up a CMS in a clustered environment. Pyplate is awesome but the one problem for me was that it changed the /etc/apache2/sites-enabled/default file to something else and renamed my other one to default.backup which meant I did not know what to tweak in this new default file generated by pyplate for my cluster - my previous default file had the cluster configurations such as URL to the slave nodes.
So how do I do this, its been 3 sleepless nights and I think Google is about ready to give up on me.
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
- iinnovations
- Posts: 621
- Joined: Thu Jun 06, 2013 5:17 pm
Re: Syncing Site with server nodes?
Why? Just .... why?
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
Re: Syncing Site with server nodes?
Why make a cluster at home? To learn about them and experiment.
Why the CMS? Well I wouldn't want to make a cluster and have each node a different site.
If you cant help, don't say anything please. http://raspberrywebserver.com is hosted on a cluster and its the most beautiful thing i have seen so I wanna make one too. (Not my original goal but if its helps you help me then help me).
Why the CMS? Well I wouldn't want to make a cluster and have each node a different site.
If you cant help, don't say anything please. http://raspberrywebserver.com is hosted on a cluster and its the most beautiful thing i have seen so I wanna make one too. (Not my original goal but if its helps you help me then help me).
Re: Syncing Site with server nodes?
According to that website in the "Installing Pyplate" article it says that you should of copied
/etc/apache2/sites-available/default
to
/etc/apache2/sites-available/default.backup
After installing pyplate before restarting apache.
/etc/apache2/sites-available/default
to
/etc/apache2/sites-available/default.backup
After installing pyplate before restarting apache.
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
Re: Syncing Site with server nodes?
So I can use my original default file. I looked at the format of the default file of pyplate and the format of a normally delivered apache default file... Both were different.
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
Re: Syncing Site with server nodes?
Figured it out with a friend.
Here is what I did to get it all working, WebPi or the author of pyplate.com e-mailed me back saying pyplate has this feature built in - I will look into it after posting this but here is what I initially wanted and it worked.
There is a script called onchange.sh it has instructions in its comments on this page: https://gist.github.com/senko/1154509
Use wget to download this script. (wget https://gist.githubusercontent.com/senk ... nchange.sh)
chmod a+rx onchange.sh
sudo cp onchange.sh /usr/local/bin
Once that is set up, change your directory into the directory you want to watch then execute the script from there like this:
onchange.sh rsync -avt . root@theIPaddressHere:/FolderDirectoryHere
Just a tip, you will need to have the keys of your servers or computers because otherwise it will ask you for a password for each file in the folder.
So to do that, you can do the following:
1. Log in as root
2. cd .ssh
3. ssh-keygen -t rsa (press enter on each prompt, it will save id_rsa.pub file in .ssh directory)
4. cp id_rsa.pub ThisIsTheKey.pub (In my case, I had 6 Pi's so I renamed it to pi001.pub)
5. ssh-copy-id -i ~/.ssh/pi001.pub root@192.168.0.81
What you just did is you generated a key on the Pi you will be using to transfer that folder, then you sent the key generated by your Pi as root to the second node that you are gonna be sending the files to. Now if you were to ssh into pi002 or wherever you sent your pub/key file, you won't be prompted for a password. I will be doing this back and forth from pi001 to pi002 so I generated a key on pi002 and then synced it to pi001. Now I can ssh into the Pi's from each other without being asked for a password.
Now you can use onchange.sh and watch its magic. Obviously there is a lot of other good stuff out there but I had fun getting this to work
I must now get pyplate to werk all by itself.
Here is what I did to get it all working, WebPi or the author of pyplate.com e-mailed me back saying pyplate has this feature built in - I will look into it after posting this but here is what I initially wanted and it worked.
There is a script called onchange.sh it has instructions in its comments on this page: https://gist.github.com/senko/1154509
Use wget to download this script. (wget https://gist.githubusercontent.com/senk ... nchange.sh)
chmod a+rx onchange.sh
sudo cp onchange.sh /usr/local/bin
Once that is set up, change your directory into the directory you want to watch then execute the script from there like this:
onchange.sh rsync -avt . root@theIPaddressHere:/FolderDirectoryHere
Just a tip, you will need to have the keys of your servers or computers because otherwise it will ask you for a password for each file in the folder.
So to do that, you can do the following:
1. Log in as root
2. cd .ssh
3. ssh-keygen -t rsa (press enter on each prompt, it will save id_rsa.pub file in .ssh directory)
4. cp id_rsa.pub ThisIsTheKey.pub (In my case, I had 6 Pi's so I renamed it to pi001.pub)
5. ssh-copy-id -i ~/.ssh/pi001.pub root@192.168.0.81
What you just did is you generated a key on the Pi you will be using to transfer that folder, then you sent the key generated by your Pi as root to the second node that you are gonna be sending the files to. Now if you were to ssh into pi002 or wherever you sent your pub/key file, you won't be prompted for a password. I will be doing this back and forth from pi001 to pi002 so I generated a key on pi002 and then synced it to pi001. Now I can ssh into the Pi's from each other without being asked for a password.
Now you can use onchange.sh and watch its magic. Obviously there is a lot of other good stuff out there but I had fun getting this to work

I must now get pyplate to werk all by itself.
Re: Syncing Site with server nodes?
How are you getting on with Pyplate? Have you got it set up the way you want?
raspberrywebserver.com - Raspberry Pi tutorials
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
Re: Syncing Site with server nodes?
I couldn't. I couldn't get the folders to sync all the way, except using a script i found called onchange.sh that script basically watches for any change in a folder and then transfers it to the next local node automatically but the thing is, it had to be actively running all the time, like manually executed. I am trying to find a way to run that command on boot so that I wouldn't have to worry about syncing the files accross nodes. The pyplate cluster management was confusing and i couldn't get it to work properly :/
Re: Syncing Site with server nodes?
You could use cron to start onchange.sh. Do you run it as user pi? If so, open the crontab file with this command:
and save this text in it:
Apart from that, is Pyplate working properly? Can you access the admin area and add new pages etc?
Code: Select all
crontab -e
Code: Select all
@reboot /path/to/onchange.sh
raspberrywebserver.com - Raspberry Pi tutorials
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
Re: Syncing Site with server nodes?
Oh yeah absolutely fantastic. I love it! Just a request though, make it mobile compatible like pyplate.com
Issue with that crontab is that I have to be in the directory i wanna sync. So for example if it were /usr/share/pyplate I want to sync to a node at 192.168.0.80, I would need to run that script whilst in /pyplate
I seriously cannot thank you enough for this though.
Issue with that crontab is that I have to be in the directory i wanna sync. So for example if it were /usr/share/pyplate I want to sync to a node at 192.168.0.80, I would need to run that script whilst in /pyplate
I seriously cannot thank you enough for this though.
Re: Syncing Site with server nodes?
You can put more than one command on the same line using a ';' like this:
What do you think of the theme for http://linuxwebservers.net/? I need to spend some time tweaking it, but I could let you have it in a few days.
Code: Select all
@reboot cd /some/path;onchange.sh
raspberrywebserver.com - Raspberry Pi tutorials
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
-
- Posts: 85
- Joined: Sat Aug 30, 2014 2:34 am
Re: Syncing Site with server nodes?
It looks beautiful. I would love to try it. However, since I wanted to launch my site, I went with blogger. Currently, http://theshakespear.com brings you my main page, and then blog.theshakespear.com brings you blogger. Currently I am investigating blogger because I haven't done much with it. But I would love to have some independent like your site. Hosted fully on my own server - mainly because well I can 
Looking forward to your release!

Looking forward to your release!
Re: Syncing Site with server nodes?
I've made some changes to the theme on http://linuxwebservers.net. Try it out on different devices and let me know if it scales properly. You can download the theme from http://pyplate.com/lws.zip.
There are a few issues with it. I couldn't get images or code elements to resize properly, and there are some formatting errors in the UI in the admin section. The UI stuff needs to be fixed in Pyplate rather than in the theme. Apart from that it should look ok. Let me know if there's anything that doesn't display correctly on your tablet/phone.
There are a few issues with it. I couldn't get images or code elements to resize properly, and there are some formatting errors in the UI in the admin section. The UI stuff needs to be fixed in Pyplate rather than in the theme. Apart from that it should look ok. Let me know if there's anything that doesn't display correctly on your tablet/phone.
raspberrywebserver.com - Raspberry Pi tutorials
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool