Loomio

setup backup

Pirate Praveen PublicSeen by 21

We can replicate postgresql and use rsync to backup uploads.
Replication howto: https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps

We can use backup.poddery.com (we recently set it up for full backup of poddery.com). Any volunteers?

Raju Devidas

Every time you ask for volunteers, thoughts come to my mind. We have mountains of work and small number of people to do it.

Pirate Praveen

@isaagar thanks for volunteering to set this up. See the link above for steps to setup postgresql replication. Once you test replication between mahishasura.pxq.in and mahabali.pxq.in, we can give you access to diasp.in to setup the backup.

I Sagar

@praveenarimbrathod Thank you for providing opportunity.

I Sagar

@praveenarimbrathod , ok
I will update the status

Pirate Praveen

@isaagar did you test it between two remote servers?

I Sagar

@praveenarimbrathod i don't have access to the test machines . Please , add me in the machines authorized users list.

I Sagar

We require a server for backup . As @praveenarimbrathod said one option is backup.poddery.com . Please , suggest any other option.

I Sagar

ok , what is the size of data on diasp.in ?

Pirate Praveen

@isaagar we can use backup.poddery.com. I'll share you access shortly.

I Sagar

@praveenarimbrathod ok

Pirate Praveen

@isaagar follow these steps http://fosscommunity.in/index.php?title=Poddery#Setting_up_Backup and first create a similar plan for diasp.in at https://gitlab.com/piratemovin/diasp.in/wikis/home

  1. How much disk space is used now? Add disk used by db and uploads.
  2. We'll need to attach a new disk to backup.poddery.com and mount it like we do for poddery.com (get yourself familiar with LVM. How to create logical volumes and extend it)

Let me know if you have any questions.

I Sagar

@praveenarimbrathod i will start and let you know if any problem occurs

Pirate Praveen

@isaagar where are we on it?

With the recent hard disk crash, we narrowly escaped losing data. We have to complete this urgently. @jayaura this is a prerequisite for updating diaspora. Can you help isaagar?

Aurabindo J

@praveenarimbrathod sure, please add @isaagar to diasp.in room

Pirate Praveen

@jayaura I think @isaagar is in his hometown without good internet access. @rajudv do you know where is isaagar now? You can go through the link above and try setting up replication of postgres between two vms.

Pirate Praveen

diasp.in has postgresql 9.3 and backup.fosscommunity.in (debian jessie) has postgresql 9.4. @vik @amardeepsingh can we have postgresql 9.4 backported to namaste?

Pirate Praveen

After a few trial and error, I got the hamara container to run. The problem was getting hamara-keyring package inside the rootfs. Now I have started backporting postgresql-9.4 from jessie.

Pirate Praveen

Uploaded files are backed up using this cronjob now.

30 * * * * pgrep rsync || rsync -av --delete root@diasp.in:/usr/share/diaspora/public/uploads/ /var/lib/diasp.in/uploads/ >/var/lib/diasp.in/rsync-uploads.log

Pirate Praveen

@isaagar which server are we using for backup of uploads?

Pirate Praveen

We need to find another server with 64 bit Intel/AMD architecture to proceed. I recommend we go with a scaleway VC1S model (dual core 64 bit Intel VM with 2GB RAM). We can do a crowd funding to raise the amount, it comes to 2.99 Euro per month. If anyone has cheaper options to suggest, feel free.

@tvm @vik @amardeepsingh @akshay @fayadfami @anisha @dhanesh95

Dhanesh B. Sabane

I'm a complete noob when it comes to servers, but I have a couple of friends and colleagues who might know something about it. If in case I get some useful information, I'll immediately share it here.

Pirate Praveen

Everyone starts as a noob :) If there is interest you can master the servers.

Pirate Praveen

@amardeepsingh last time when we met at Baga, Goa, we talked about a backup server we can use. @isaagar can you check with Amardeep and confirm? If not, we'll proceed with scaleway.com option.

I Sagar

Talked to amardeep about the issue . He said if you want realtime backup then we should think of external server otherwise he's ok with daily backup using postgresqldump instead of slave setup.

Pirate Praveen

Thanks for the update. I prefer slave setup as we get real-time incremental backups. With dump based approach, we may lose data after last dump in case of a failure.

Buy a VC1S instance at scaleway.com for postgresql replication with crowd funding

proposal by Pirate Praveen Closed Thu 2 Feb 2017 10:01AM

Outcome
by Pirate Praveen

We can get a VC1S from scaleway.com

We need a 64 bit Intel box to replicate postgresql database. scaleway.com offers the cheapest vps (poddery.com is using scaleway.com and it has been running great).

Starter VC1S: €2.99/month, 2 x86 64bit Cores, 2GB Memory, 50GB SSD Disk, 200Mbit/s Unmetered bandwidth

$ sudo du -hs /var/lib/postgresql/9.4/main
2.7G /var/lib/postgresql/9.4/main

Current DB size is 2.7 GB so this configuration would be sufficient.

Uploads are already backed up to backup.fosscommunity.in (which is running on an arm processor so we could do replicate postgresql there)

$ du -hs /usr/share/diaspora/public/uploads/27G /usr/share/diaspora/public/uploads/

We could share our backup server for git.fosscommunity.in as a return gift (which also share the same issue of 64 bit Intel to arm replication incompatibility).

Results

Dhanesh B. Sabane
Agree

I'm slowly getting a hang of this.. Agreed! 👍

Pirate Praveen

I just signed up at scaleway.com. Access details are updated in our private repo, encrypted as usual (just added @isaagar ).

Pirate Praveen

@isaagar said he'll setup backup over the weekend.

[03:34:20 IST] ‎piratepraveen‎: isaagar, we now have a scaleway.com account
‎[03:34:38 IST] ‎piratepraveen‎: isaagar, would you be able to fins some time to complete backup?
‎[03:35:28 IST] ‎piratepraveen‎: I suggest we create one instance in Amsterdam, I guess Netherlands is better for privacy comapred to France
‎[03:35:46 IST] ‎piratepraveen‎: bsc, fayad dhanesh95 ^
‎[03:36:04 IST] ‎fayad‎: piratepraveen: hi
‎[03:37:14 IST] ‎isaagar‎: piratepraveen: i will do in this weekend

Pirate Praveen

[07:35:56  IST] ‎tvmanukrishnan‎: I have a dedi idling at online.net. Can spun up NAT ed VPS's. That would be good enough for backup, I hope. Additional IP with them cost 2 Euro + 3 Euro setup charges.
‎[07:36:32  IST] ‎tvmanukrishnan‎: Can have encrypted disks too.

@isaagar @fayadfami , we can use @tvm 's VPS then instead of scaleway.com

Manu Krishnan T V

Do you need encrypted disks? If so, I need to create a KVM machine with disk encryption.

Otherwise, an LXC container will do, for which disk space can be expanded any time.

Btw, how much storage space are you looking for?

Pirate Praveen

yes, we should encrypt the disk. postgresql data dir is about 2.7 GB. So I think 10GB disk would do for now.

I Sagar

I am configuring mayasura and will update the wiki. @praveenarimbrathod Need help on server side configuration.

Pirate Praveen

Feel free to ask here, xmpp, or irc/matrix.

I Sagar

@praveenarimbrathod @fayadfami @tvm On slave , it says could not connect to master server "210.7.64.54" .
We set max_wal_senders to 1 (on master) and including this backup server I think we actually have two backup servers . Should I increase value of max_wal_senders to 2 ? or Do you see any other problem ?

Pirate Praveen

Since cannot use the first backup server, can't we remove the entries for the the first backup server?

I Sagar

Ok , I will comment out the entries of first server , to see if problem solves or not.

I Sagar

The problem was port 5432 of diasp.in was firewalled and after allowing port 5432 , slave is connecting to diasp.in.
But , I haven't seen in logs on slave machine info. relating live transactions . When I started slave machine then last entry in log says "ready to accept read only connections"
I think I should wait for some time if data is really replicating on slave.

I Sagar

I have checked running postgresql processes on master and slave server , it seems replication is running properly . I will update the wiki about the setup.
Also , how should we do the monitoring ??
@praveenarimbrathod how do you monitor backup server of poddery ?

Pirate Praveen

@isaagar 👍 super! For poddery, we just check if the backup server is running or not as backup server was getting hanged in the past. We can setup a ping test for the backup server. Also we should do a daily full db dump on the slave using cron job. We should keep the dump of last day and last week and delete the rest. This is just be on the safer side if some bad queries can mess up the db. Can you try that? or anyone else wants to volunteer for that?

I Sagar

Added cronjob for full db dump .