Found 2 results for tag "sudo"
October 31st 2013 05:19 am
After many, many months (and many mistakes), we finally have our own backup server!
Let me explain: when we had our data hosted on 3rd party servers, backups were never considered because the services already provided backups (or, so we were told). We only had to use WebsiteSource's backup service once, and the other company said they were creating a backup service, but never put us on it.
When we moved our data to the primary local server back in September, my level of worrying gradually increased over time. We had all of our site data on 1 server - and if that server were (for some reason) to crap out, we'd be in a very large hole with no way out. 8 years of coding. 8 years of projects. 8 years of client work. 8 years of a full portfolio. 8 years of database records. All gone.
Luckily, that hasn't happened yet (and we hope it never will - oh, the horrors if it did). So, in order to fill in this gap, I finally got the courage to make a backup server! (finally, right?)
I was able to salvage a bunch of the spare parts that I had laying around. Some RAM, some hard drives, a few semi-barebones desktop frames, motherboards galore...and all of this stuff was just collecting dust in various areas.
I went through a bunch of combinations of RAM/Hard Drives/Motherboards/CD Drives before I found a combo that worked (a few of the frames that I had required SATA drives, and I only have ATA/IDE drives available).
I finally got some RAM that fit appropriately, a large enough hard drive to hold the information that I needed (not the same size as the main server drive, but big enough), and a CD drive that worked (I had to install the Server OS somehow, right?).
After spending all of today getting the latest Ubuntu Server ISO downloaded and burned, I popped in the CD, ran the install ISO, and had a dedicated backup server ready to go.
I then spent the latter part of the day setting up
mysqldumpto automate the creation and mirroring of backups.
MySQL Dump Script:
#!/bin/bash BACKUP_DATE=$(date +'%F') mysqldump -u [username] -p[password] --all-databases --events > \ /var/www/vhosts/$BACKUP_DATE.sql
--eventsis here because it was returning an error saying "Skipping mysql.events table"
#!/bin/bash N=$(date +'%F %T') LOG_FILE="$HOME/rsync.log" echo "RSYNC Begin: $N" >> $LOG_FILE rsync -r -a -v -e "ssh -l [username]" --delete \ [source directory from root] [remote_server_ip]:[remote directory from root] >> $LOG_FILE echo "---------------------------------" >> $LOG_FILE
--deleteis to delete any remote files that aren't on the source location. Also, if you want to only sync certain file types, add "
--exclude='*' --include='*.[ext]'" after
--delete(exclude everything except what is included), or you can just omit
--deletealtogether if you want. The rest of the script is just log information - completely optional, but makes the log easier to read
Update 2013-12-09: I've updated the script a bit to make it a little more universal after some things were called to my attention
The main part of that was spent trying to get the backup server (which I am calling "Fry" - I'm thinking of going Futurama for a server nomenclature) to automatically SSH into the main server without a password (aka: storing an SSH key). I had to learn a lot in order to do that, but I found out that the problem that eluded me for about 5 hours was that the main server's home directory had the wrong permission settings for the
Next time the SSH keys aren't being stored right, run
[sudo] tail -f /var/log/auth.logand see what the error is. Lesson learned.
So, the overall point of this story:
- A dedicated backup server, Fry, has been salvaged, installed, and setup
- There is an
rsyncscript on Fry to automatically sync up the files from the main server (all 40GB+ worth)
- The Main Server has an automatic
cronscript to run
mysqldumpto make a full backup of all of the MySQL database
rsyncwill keep the latest 6 (daily) copies of the MySQL Dump backups along with the main backup
rsyncscript creates a custom log to record the output
Now to install a Leela (why not Zoidberg?) server for load balancing (or a production server. I don't know - I've never had more than 1 server running locally at a time).....
....and just because this whole "end of the year" thing is so chaotic, here's a comic I liked which I hope to do (just to get it all over with):
September 14th 2013 11:58 pm
It's halfway through September, and things have been less than calm. Ever had one of those days where nothing goes right and you pretty much have to change everything in order to fit one request/demand/requirement? Yeah, stretch that over about a week, and that is/was my past 2 weeks.
Here's the rundown:
Server Downtime, Transfer, and Remodification
Over the past week, I had to majorly downgrade/upgrade the primary hosting server for Shadow Dev. Since our primary hosting environment was costing us $200/qtr, we were looking for an alternate hosting environment. The requirements were simple: Linux hosting environment, ability to SSH into it from a remote location, and root access. You'd be amazed how many services out there offer a "Windows/Linux" environment for a much lower price, but no Admin/Root access. I'm sorry, but I need direct control over the server, and shouldn't be waiting on the hosting service to perform updates (especially security updates).
So, we had a partner company help us out. Over the past few months, we transferred all of our primary data to their hosting server, since they were helping us out. Things were going smoothly. Our old VPS system ended their service on September 1st, and we weren't going to renew. Things were going as expected.
Since our primary hosting environment was hosted semi-locally, I split off my personal stuff and the business stuff. I modified the DNS servers to point home so I could host my personal website (this one), and have the business stuff on a "business dedicated" server. Meanwhile, my plan was to relaunch the main Shadow Dev site with a new design and direction on September 1st, but that had to be delayed by a few days.....and then the problem started.
Do you recall my previous blog posting about the "Server Connection Confusion"? On September 2nd, I was trying to SSH/FTP into the server to update some business pages and could not get through. I could access the server via Port 80 (HTTP), but not 22 (SSH) or 21 (FTP), which meant that I could view what was on the server, but I could not modify it in anyway. There was one option: I could access Port 10000 (VirtalMin backend management) and download/upload one file at a time, but I had about 200 files to download, modify, and upload, so that would have taken forever. I kept trying over the next few hours with no success.
On September 3rd, I tried to access the server hoping that the Port 21/22 issue was just a fluke (as it sometimes happens). However, I could not access any part of the server. SSH, FTP, HTTP, VirtualMin backend, Email, anything (which meant that my primary email server was down as well). I sent an email to the company that manages the physical hardware and said that the server was down and if they could look into it. Their response: "Yes, it is down, [they] will boot it back up. You will need to start paying for this server or remove your content from it. Out accounting software has placed a hold on it. As we have decided our relationship has not been mutually beneficial." Long story short: our "tradeoff" was not paying off. The tradeoff was "website service" for "hosting space". I should have realized something when the person we were talking to said "You have creative freedom." In an inexperienced mindset, that means "YAY! I can do anything without limits and they will like it!" In an experienced mindset, that translates into "I don't know what I want. Read my mind, or I will turn down any ideas/suggestions you have" which, in a "web designers" standpoint, is a huge red flag. It also doesn't help that we only had one informal meeting about a new site for them.
Anyway, in my response to that email, I said "If that is the case, then we will remove our content from it. In our current state, we cannot afford $1200/year for hosting, as we were paying $800 before. / Please reactivate it so I can move all of the content from it within a reasonable timeframe, then you can do with it as you wish. / I wish our relationship could have been more beneficial."
Afterwards, I tried to re-login to the server (as I was told they would boot it back up). Same result: nothing.
I waited and tried to re-login to the server over a few hours. That turned into the next day. I sent another email to the company restating "Please reactivate the server so I can move all of the content from it within a reasonable timeframe".
Once again, nothing. This downtime was really starting to mess with our uptime records, which we try to strive for a 99.9% uptime record. This was not helping. However, I did get an idea; get a cache of our main site (CSS3 and minimal design concepts only), modify my home server to act as a proxy-hosting server, and get the uptime records going. It took about 3 hours to get (since the primary hosting server was pretty much "blocked"). Thanks to CloudFlare's uptime caching, I was able to get the egg, the egg shadow, and the CSS3 that I used to make it move. I made the DNS changeover, and our uptime was back up and going. It wasn't the full-fledge hosting server, but it's better than nothing.
Day 3 of primary server downtime: I sent yet another email to the hosting company and said "I have tried to be patient with you, but my patience is wearing thin. I have asked nicely in my previous emails to reactivate the hosting server so I can transfer our content off of it. I have not heard back from you since my email on the 3rd. Since it seems like you are holding our content hostage, we are facing our 52nd hour of downtime, and our clients (and ourselves) are suffering that have their sites hosted on this server. In addition, any one who has email being handled by the server is not receiving any emails, including myself, which is causing panic since the emails are not bouncing or anything." Seems like a mostly professional message, right? (By the way, we had about 25GB that we needed to get - note to self: don't have the primary hosting and backup services by the same 3rd party)
I received a response within minutes: "You patients is thin? It is your actions that caused your problem by not producing anything. If you are that poor of an admin and do not have a backup of your content sounds like a personal issue... However I have issued the boot command to your server. Remove your content asap." (yes, misspellings and typos are maintained). I will say that 'Yes, we did not have a primary backup, because you said that you were going to enable that for us, but never did after many months of saying you would.' Regardless, situation has passed.
Anyway, the server was booted back up, which meant that I could get the files....or so I thought. I tried to SSH into the server, but for some reason (whether through my own doing of automating a port blocker or not), I could not. After many hours of fiddling with system and network settings, I came to a conclusion: my IP address was being blocked via Port 22 (SSH). This meant that I could not SSH into my home server and initiate an SCP transfer (Secure Copy - basically a command-line FTP between two Linux-enabled boxes). However, FTP was still open, so I initiated a primary backup to my home desktop (not the home server). I had the max system simultaneous downloads set at "2". I increased it to "3". Yay, things were going faster. I increased it to "4". Even better. I increased it to "5", and things crapped out. I could not SSH/FTP/HTTP or anything into the remote server. Which meant that I was back at square 1.
Based on my previous experience, I knew that I could log in to the server via SSH using my phone (thank you ConnectBot) and the 4G connection. I did so and tried to initiate an SCP connection from the remote server into my home server (for some reason, incoming SSH connections from my IP weren't getting through, but outgoing's a whole new story - and before you bark at me, yes, I did check the
iptablesfor an Incoming blocking rule. There were none. Anyway, I let that run since I thought things were going a bit slow, but better than nothing.
After about 30 minutes, ConnectBot just quit. No reason, no message, no disconnect dialog boxes. It just quit. Which meant that I couldn't SCP for more than 30 minutes, which was a problem.
I tried to FTP into the server again, and was able to. I decreased the amount of simultaneous downloads to "4" and let it run. It took about 8 hours to transfer everything, including the primary MySQL databases.
After everything transferred, I ran a
rm -rfcommand in the
/var/www/vhosts/folder. I know it's not completely secure, but at least it gets rid of things on a first level basis (installing a secure command like
shredwas possible, but the documentation didn't say anything about shredding a folder - it was only 1 file at a time, which for 25GB, will take a very long time). I also dropped the primary MySQL database and let it. My last words: good riddance.
So, I had the primary hosting files on my home desktop. Now to begin the mega-upload to the home server. 3 hours later, transfer complete. Now for the fun part: setting up the "Linux Desktop" to operate as a "Linux Server" (which, by the way, is not GUI based anymore, so all of this was done via Command Line), to be able to handle multiple domains and subdomains, import the huge MySQL database dump, setup the permissions for the databases, files, and folders, and re-initiate the cron jobs to run. Let's just say that I'm 99% done all of that as of now.
One of the hardest portions I had to deal with was separating out all of the domains. Let me explain: on the old hosting environment, all of the domains (except for the primary shadowdev.com domain), were managed and recorded under one central
apache2.conffile, which Apache looked for and loaded for all of the domains. My home server, although the same operating system, didn't like that. Therefore, I had to go into the primary
apache2.conffile and separate out each domain into it's own file under
/etc/apache2/sites-available/[site], then run
sudo a2ensite [site]to make it enabled, then
sudo service apache2 restartto allow for the webserver to reload and reread the configuration files. Yeah, that was fun.
I still don't have the Postfix/Dovecot system completely operational yet, but the server can now receive and forward emails. It can't 100% send emails yet, but I'm working on it. I also have some finer points of the cron jobs to figure out. Aside from that, the server (hopefully) should be back up and operational.
Liquidation Sale Troubles
On a related note, we had our Liquidation Sale on the 31st for the office. Let's just say that apparently this town doesn't like any "Liquidation Sale" signs around the area. I posted a few around town, hoping that they would allow them for just a few days (since the event was on the following Saturday). I can understand taking down signs that are for an event a few weeks away, or for personal services or hand-written items that are pretty much illegible. However, after checking on all of the signs I put up, all of them were taken down. Now, I want to hope that it was because people liked the event and wanted to make a note of when/where it was. Based on the attendance record of Saturday, it was obvious that the signs were removed. We only sold $110 worth of stuff, 1 buyer, and 2 browsers. I mean, it's better than nothing, but I wish that we sold more. Now, the agreement that I put in with the landlord was "Anything that we didn't sell on the 31st is free-for-all for any tenants." That didn't translate quite as I expected. It turned into "We [the landlords] will keep what we think is ours, but you have to remove everything else." So, I get a large box from Walmart and try to remove a bunch of the small stuff. I receive an email a few days later saying "We have a tenant that would like to move in, so please remove all small items from the office." So I have to get another box (luckily they are cheap) and go back and get the rest of the small stuff. So much for getting rid of all of the small stuff.
Let's just say that our home is overflowing with office-related stuff. I'm just glad that we don't have to bring any of the BIG stuff home - I have no idea where we would store it. So yeah - our nice, professional, dedicated office is now sitting at home.
Getting the main site back up
State of Shadow Development Address for the public. Basically, it says that "We did our best, it wasn't good enough, so we are changing directions to pursue new ideas." That's pretty much it summed up. You can read the rest if you want.
I've been working on finishing up the touches on the new Shadow Dev site (like cross-browser compatibility, improving it's performance on other connections, and finishing up the content distribution with the database. It's coming along a bit slower than I had hoped, but working at home has it's own pros and cons to it.
Personally, I'm having a hard time dealing with the major downsizing and removal of partner services. What I had to do 7 years ago in my dorm room (where I had the main hosting server sitting in my dorm and I was managing all of the services via Command Line Interface (CLI), I'm doing yet again. Although I'm more experienced in how to handle the technology, and the technology is a bit easier to handle, the amount of responsibility needed to make the server work like it was before is no short order.
Lunar Productions' mangas. I did create a new site for them using the old Shadow Dev design, and ramped up the interactivity and information distribution (see beta.lunar-productions.com for a preview), so that helped a bit. However, I can't launch the new site yet until we get some final items down pat. I did, however, completely revamp Death Rose into a new series. Any storywriter will tell you that there was a part in a story (or even the story itself) that seemed to make the storyline go off-track. Well, Death Rose wasn't going anywhere, and I was getting tired of forcing myself to write storyline that didn't fit. So, I revamped the whole thing: the primary storyline, the storyline concepts, the characters, the antagonists, the setting....everything! It's now called Crystal Blaze. Let's just say that it's like Sword Art Online/Matrix/StarCraft/Accel World/Star Trek mix. Yeah, I know it's a lot, but it is making sense, because I'm already on Page 19 of script. The story is unfolding in my head, and sometimes my fingers can't keep up to type the story fast enough. I will say that the beginning of the story is a bit slow, so I am thinking of adding some concepts in the beginning to make a more enticing "hook" to the story. We'll just see where it goes.
Wedding Ups and Downs
On a positive note, we have the Colonnade! (For the wedding, not permanently) The final "OK" was put forth by Keat's parents and we were able to sign the contract and put the downpayment in. That's just 1 of the multistep process that is wedding planning. (see more details at (temp site) kk.shadowdev.com - actual domain to come later) I will say that I knew the whole wedding planning process was going to be tough, but I thought the major disagreements and compromises would be between Keat and myself, not Keat and myself vs her parents. No matter how much planning we/I put in (I am saying "I" here because I have been self-designated as the primary planner since Keat is finishing up her last year of school. As anyone will say, "Put Education First". She's already taking 18 hours of classes, and my schedule is not set, so it's pretty much been put upon me to do most of the calling/negotiating/researching/quoting/etc for this event), it seems that her parents have some minute detail that they must demand. For example: the reception. During our discussions, Keat and I talked to the event planner at our location. She gave us a packet that outlined all of the details, prices, and items that would be provided for the reception. I had a few follow-up questions to clear up any non-clear items (like "when does the 4-hour reservation start: when the guests arrive, or when the crew starts to set up" and so on), and things were going well. Suddenly, Keat's parents demanded to have custom beer and wine at the event. They even "suggested" (kidded? I hope) to have a keg at the reception. I'm sorry, but if this was a frat party, a keg would be acceptable. At a wedding reception? I may not have been to many nor planned many, but I find a keg unacceptable.
Anyway, we asked our location how much it would be to have "a local microbrewery supply beer and a remote winery supply the wine". According to the planner, they had to purchase it because of their liquor license. Okay, understandable. I don't want to impede the liquor liability on any one unnecessary. After 2 months of asking that question, we finally received an answer: the microbrewery has to bottle their beer and ship the bottles. Our cost: $10/bottle. HOLY CRAP! $10 a bottle? That beer must be made of gold or some super rare gems! We still hadn't heard back about the winery question, so I contacted the winery directly. Within a few hours, I received a response and forwarded that to our planner. Still haven't received a response (I think at this point, they are starting to hate us and may force-cancel our penciled-in reservation with their location). After waiting so long, Keat's parents said "Let's forgo the custom wine and beer and just go with what they have. Can we get an itemized proposal for this?" At the absolute end of my frustration, I sent a calmly-worded email to the planner and asked the question. She pretty much responded with the exact same thing that the packet says that she gave us. The location, the DJ, the setup/cleanup, China, Silverware, chairs, linens, tables, etc, etc, etc, for the set price (tax and gratuity included as well). If they were getting mad at us, I don't blame them, but please don't kill the messenger. We're just passing the message along to get the check signed.
7th Anniversary Cake from them, but I don't want to go to them for a wedding cake. That's like having a keg at the reception. At this point, it's either "go all in or get out" kind of deal. I don't (and Keat doesn't) want to compromise on a lower-quality cake that we will wish we could have improved 20 years from now just to save a few bucks. So, I contacted other cake companies around here and once you add in the amount of guests we will have along with the design concept we want (along with their delivery fee), it pretty much averages out to $800. (We had a "phone conference" (although if you call Keat's parents on 1 phone and Keat and I on another a "phone conference") about the overall budget. Basically, Keat's dad was mad that we had multiple versions of the budget. I thought he would be happy that I split the budget up into 2 categories (Estimated and Actual), then subsplit that into what Keat's parents would pay, my parents would pay, and we (Keat and I) would pay. That seemed acceptable, but he had made some adjustments that we didn't know of until he sent us his copy. I sent him our latest version (since we were the ones doing the research), and he seemed to get upset that there were multiple copies floating around, so he claimed "his" copy the official one, which means that any additions that we find due to research, we have to let him know instead of just using our own copy. I thought I could simplify things by using a Google Docs copy that would allow for simultaneous edits from multiple users, but that seems to have majorly backfired as they do not know how to use Google Docs, so we are back to "his copy being the only one that should ever exist" scenario. Yay.... I have, however, asked on multiple occasions "What is your optimal budget? What would you like to spend on an event like this? Therefore, we can stay within that range and know what the limits are." Seems like a reasonable question, right? I mean, we're trying to shoot for a $10k budget. Keat's dad is acceptable with a $15k budget (in passing conversation), but we aren't trying to spend millions upon millions on this thing. Heck, we're even below the average cost for a wedding Haywood County ($16-24k). The only answer we have received is "We don't have a set budget - we just want to make you happy", which means (yet again) "Read our minds or we'll turn down every idea and suggestion you have". Great.....)
So, if this whole wedding thing was a TL;DR for you, let me sum it up: we have the Colonnade for the ceremony, I think our Reception location hates us, we need to find a high-quality custom cake for less than $800 total, and the budget seems to be out of our hands.
Additional Money Needed
So, in order to gain some additional money in order to pay for this "seemly outrageous wedding", I decided that I should try to apply for some part-time work (heck, since I don't have to "go into the office" any more, my schedule is pretty freed up). I found out that there was a Trader Joe's opening in Asheville, so I tried to drop off an application last Tuesday. The website (which isn't 100% working) said that they were accepting applications Monday-Friday, 10-7. No problem, right? I arrived at 4:12pm on Tuesday. There was a whiteboard out by the front door that said "Accepting Applications: Tuesday - Thursday, 10-4", which meant that I was 12 minutes late. Well, that's pretty much a trip to Asheville wasted. However, thinking ahead of this process, I thought "Why not apply to Kitchen & Company?" (it's a kitchen supply company that offers a whole lot more than Walmart or other kitchen companies. Keat and I found a lot of good quality stuff in this store during our previous trips). I tried to contact the store via their website, but their careers section was on their parent company website (which was a pain to find), and they only have 1 job posting available. They said "Please contact our Admin offices to inquire about other positions", so I sent them an email inquiring about the question in hand. Within 30 minutes, I received a response basically saying "Walk into the store and bring a resume." Seems simple enough, right?
Well, I head on over to the store and start to walk in. Little did I know that there was a sign on the front door that said "Part Time Sales Associate: Must be energetic, ability to multitask, and passionate about cooking" (I may be paraphrasing here). Seems like my kind of day! (Since I do most of the cooking at home anyway). I walked in, asked for an application, filled it out, and talked to their manager. Since he saw that I had previous experience at Staples, he said that this would be pretty much the same thing (I hope so too). Although, if there is a "Kitchen Quiz", I should be ready. Questions like "How many teaspoons are in a tablespoon? What's the difference between a Santoku and a Chef's Knife? What does a 'sharpening steel' actually do?" and other questions should be easy, thanks to Alton Brown. I don't know if there will actually be a quiz, but can I say that I kind of hope so? Anyway, I received a letter in the mail today from Trader Joe's saying "Thanks for applying, but you have not been selected for an interview." Basically saying "Thanks for coming in, and we appreciate your interest, but we don't need you right now." Oh well - my dad did say to stay out of the Grocery business. I guess this is the Universe's way of keeping me out. No biggie - I have higher hopes for Kichen & Company anyway.
New Anime: Accel World
I will say that it had some flavors of Sword Art Online, and I liked how it wasn't exactly the same (as the author wrote this post-SAO and submitted it first to a writing contest, where it won first prize) as SAO. The concepts portrayed in the series were unique enough to hold their own, but also reflected some traits of other series like Bleach), so I was able to find those traits and mold them into what Crystal Blaze (and other series) should offer. I was never in any "Creative Writing" classes, but I believe this gave me a better understanding of how to write a compelling storyline (although I still have the fan-crush on Asuna from SAO. Accel World didn't really have any characters that I could really connect with, but that's not necessarily a bad thing).
Is this the end?
That's it for now. I believe that 27,000 characters is pretty much my max limit on a blog posting like this. However, I hope this gives a better insight to what one chaotic, crazy week I have had.
Tags:#swordartonline #accelworld #wedding #colonnade #vr #kitchen&company #traderjoes #altonbrown #beer #crystalblaze #lunarproductions #shadowdev #design #server #hosting #sale #apache2 #sudo #scp #ftp #http #css3 #email #virtualmin #port #bug