Category Archives: Admin

nginx vs haproxy

I have been using haproxy as front-end reverse proxy and load balancer for one project for several years and I’ve been very happy with it’s stability and performance (although actual load  was always very moderate).   In another (more recent) project I decide to try nginx in a similar role (but actually I needed also to serve some static files, which was actual reason to try nginx). Continue reading nginx vs haproxy

Converting files in directory structure

Often I needed to convert a set of files (audio files to different format,  text files to different encoding, …)  in some directory structure and save results to a  new destination while retaining directory structure.   In order to walk through directory structure we can use find command,   but if we are to create output in new place, subdirectories have to be created, which is where find command line gets bit complicated (especially if we have to consider spaces in files/directories names).   So here is an example for converting text files encoding:

find . -name "*.txt" -exec bash -c 'mkdir -p "/dest-dir/`dirname "{}"`"; iconv -f utf-8 -t windows-1250 -o "/dest-dir/{}" "{}"' \;

Software RAID 1 And LVM

While adding more capacity to my Ubuntu 12.04 based server I decided to use two disks in RAID 1 – although the whole topic is well discussed and described, it still took me some time to put all pieces together, so here I’d like to share my experiences. Plus there are couple of decision point on the way, so I’d like to explained my decisions, based on informations  I read. Continue reading Software RAID 1 And LVM

Diskless PC (booting from USB stick) with Ubuntu

Recently I decided to revamp my linux HTPC and this time to do it properly – there is no disk and all media are on separate server (or NAS – I prefer server, because I’d like to run some other things there, which might be problematic to run on pure NAS box). New PC should boot from from common USB stick – 8GB – value around 5 EUR (I thought it would be more convenient to build  system and I did not have any server yet to boot from network only – actually old HTPC would become server, but first new HTPC has to be created). To overcome two major issues of common USB stick – limit on number of write operations (too much writes decrease lifetime of the stick) and slow write operations speed I decided to use overlays file system (or sometimes called union file system), where (once all system is set up) all writes go to memory – this is similar to linux live CDs or USB sticks. In order to be able to do some user customizations after installation and that user can save various data his home directory, the home directory is hosted on server/NAS and shared via NFS. The  recipe described below is for xubuntu 12.10. Continue reading Diskless PC (booting from USB stick) with Ubuntu

Xen 4 – Combined Bridged And NAT Networking

Normally Xen is deployed with plenty of of public IPs,  so it can use bridged networking and each virtual machine can have it’s own public IP.  However in my case I was limited by only 1 public IP, but I wanted to run several VMs with services accessible from outside.  Solution was to modify XEN networking scripts.

Idea is to use an internal bridge with hidden IP subnet and to use NAT and port forwading so particular services on VMs can be reached from outside (on public IP, which is assigned to DOM0).This solution works for me successfully on Debian Squeeze. Continue reading Xen 4 – Combined Bridged And NAT Networking

Quick And Dirty Oracle Backup

I have an Oracle 11g installation running in virtual machine (under Xen). Oracle is used for APEX development and some host few local applications for our team. From time to time I need to do cold backups – to keep data around or to move them to another VM on different server, which is running identical version of oracle  and can be used as cold backup eventually.   The backup device is an USB disk with FAT32 filesystem (FAT32 was chosen a while ago for compatibility reason – to be able to attach it to almost any OS) and the disk is attached to other server. FAT32 means that there is a limit on file size, so the database backup need to be split to chunks (backup is 10-15 GB). Of course RMAN can do proper job, but since I’m no real DBA I want to have something quick ( data are not mission critical and also it is no problem to bring DB down) – so warning do not apply this procedure for important databases – no guarantee that it will work in all circumstances and you may loose your data . Continue reading Quick And Dirty Oracle Backup

Bash Autocompletion for Root

Debian/Ubuntu do not have bash autocompletion enabled for  root account by default.  When working under root account, this is quite missed feature,   but luckily it can be enabled very easily:

cd ~
apt-get install bash-completion  # if not installed - like in minimal Debian install
nano .bashrc

add folowing to the file:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Sudo without password

I need to use superuser privileges quite often and not so particular about security, but still want to work mainly under my own user.  The solution is to set sudo not to require password for my user:

sudoedit /etc/sudoers

add following line to the end:

your_user_name ALL=NOPASSWD:ALL

As noted this is basically a security risk, so apply only if you are sure what you are doing.

 

Partly Cloudy – Openstack in VM

Having heard so much about clouds and ‘Infrastructure as A Service’ recently I decided to try Openstack – complete open source solution for cloud computing.   Openstack is actually a set of softwares, that together provide necessary services for a cloud infrastructure.  Openstack (Essex release) can be installed in virtual machine, Virtual Box in my case, so I gave it a try and here are some of my observations: Continue reading Partly Cloudy – Openstack in VM