I’ve been playing around with Docker a lot recently, and one thing that seems to be lacking is a way to update all of your downloaded images in an “apt-get upgrade” fashion. I know this isn’t usually needed in most cases, but in a home use case for Docker most of the time, you can upgrade everything in one go and not worry about it. So I wrote some quick one-line scripts in Bash and PowerShell that can be used to update all your docker images. Continue reading Updating all your Docker images in one swoop.
At work, our ERP system is built on Oracle running on a clustered Linux (Red Hat Enterprise) environment. Since this is a high availability/failover setup the processes running our development databases can be on either server for any number of reasons. I wanted to make installing code a bit easier on the server so I made some bash scripts to partially automate the install for me. Not wanting to get errors when it tries to install code on the wrong server, I found this little command to determine if the database is running on a server and thus let the script go on with the install.
ps -U oracle -u oracle u | grep -q pmon_dev2
Lets break this down into each part. The first part,
ps -U oracle -u oracle u, gets the currently running processes running as “oracle” (first “-U” for real and second “-u” for effective ID) in a user-oriented format (last “u”). This is similar to an example in the MAN page for PS and I just replaced the usernames to fit my case. The pipe (“|”) takes the output from the left side, the PS command in this case, and uses it as input for the right side. The second part,
grep -q pmon_dev2, searches for “pmon_dev2” in the output from PS, the “-q” option suppresses output and exits successfully if any match is found.
So I just put this at the beginning of my script:
if ! ps -U oracle -u oracle u |grep -q pmon_dev2
echo "DEV2 not running"
This exits the script right away if the database isn’t running on the server. If it is, then the script goes on to get the latest code from source control run the code install and exit. If you can do this with no user input, then you can setup a CRON job to run the script to automatically get any updates.
After spending most of this week working with and debugging approximately 8,000 lines of PL/SQL contained in two packages, I want to mention “Refactoring” by Martin Fowler. It’s one of the few books I had to buy in college and have kept since then. If your code smells, clean it up… That is all.
Now back to your regularly scheduled programming.
So I’m working on a project at work to evaluate and implement a source control system to replace a fairly non-existent use of Visual SourceSafe. It has been a while since I’ve looked really in depth at any version control software and I have to say that I’m impressed with the advancements around them. Not necessarily in the version control systems specifically, but in a lot of the auxiliary functionality that they can offer either natively or as with easy add-on. Things like automated builds and continuous integration are things that weren’t even on the map last time I looked at this in any depth.
At my work we decided to evaluate three types of version control; Team Foundation Server (TFS), Subversion, and Git. I’m most familiar with Subversion since that’s what I’ve used in the past and TFS is a fairly obvious choice for us since we are mostly a Microsoft shop with the tools we use. Git however was a bit of a research project for me and I have to say that we fairly quickly decided that it wasn’t for us. Don’t get me wrong it has it’s use cases where it shines, particularly in development environments where the development team is widely dispersed geographically and not necessarily always network connected. In these cases Git seems really ideal which is probably why it has taken off and is so popular in open source projects, but this is completely different from our primary development environment and the downsides outweigh these benefits.
I don’t know which way we’ll end up going at my job. We’re wanting something simple that will be easy to use and we’re just implementing source control as part of the project. This is why I’m starting to think that we might go with Subversion because TFS can be such a bear to administrate and after getting them installed and starting to set them up, I can understand.