Monday 29 December 2014

Configure bamboo with NEXUS - Sonatype

I use for configuration bamboo 5.7.1 and all configuration will be done from script - I not use plugins

First I prepare build project consists from 2 stages
- one for prepare package - for example zip file
- two for update package to repository - NEXUS

When I have zip file to upload to NEXUS I use NEXUS api to upload file
#use timestamp to versioning
VERSION=`echo "${bamboo.buildTimeStamp}" | sed 's/:/-/g' | cut -f 1 -d "."`
#uploadcurl -v \
   -F "r=releases" \ 
   -F "g=pl.company.sql" \ 
   -F "hasPom=false" \
   -F "a=db" \
   -F "c=${bamboo.buildResultKey}" \
   -F "p=zip" \    -F "v=$VERSION" \
   -F "file=@./$f" \
   -u  deployment:${bamboo.nexuspassword}\ 
   http://service/nexus/service/local/artifact/maven/content
important is use classifier

or You can use MAVEN

Second - download script for deployment project

#Fix mapping between buildResultKey
CLASS=`echo ${bamboo.buildResultKey} | sed 's/-/-RDP-/2'`
-For more information see post below and continue
#find package by classifier
VERSION=`curl -u  deployment:${bamboo.nexuspassword} "http://service/nexus/service/local/lucene/search?g=$GROUP&a=$ARTIFACT&c=$CLASS&r=$REPO" | sed -n 's|<version>\(.*\)</version>|\1|p' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'`

#Download by wget
wget -O db-sprint.zip --user deployment --password=${bamboo.nexuspassword} "http://service/nexus/service/local/artifact/maven/content?r=$REPO&g=$GROUP&a=$ARTIFACT&v=$VERSION&p=zip&c=$CLASS"



Configure mapping between build project and deployment project in Bamboo

Atlassian Bamboo don't have formal mapping between build project and deployment project but you can use buildResultKey - it constain number of build which is constant.

I create build plan and deployment plan in deployment plan set to update buildResultKey to be correct for deployment plan

echo ${bamboo.buildResultKey} | sed 's/-/-JOB1-/2'

You shoud list buildResultKey variable in build project and deployment project and check difference - for me it is JOB1

Monday 13 January 2014

Targetcli performance - 1Gbit network

Testing targetcli - cofigured in Targetcli configuration iSCSI

create ramdrive on target
mount -t tmpfs -o size=7G tmpfs /mnt/ramd
Create file in ramdrive
dd if=/dev/zero of=/mnt/ramd/test1 bs=1024 count=6000000
6000000+0 records in
6000000+0 records out
6144000000 bytes (6.1 GB) copied, 8.75343 s, 702 MB/s

Map file to datastore in targetcli
Connect to target
iscsiadm -m node --targetname "iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.1a7b82ef561a" --portal "192.168.42.135:3260" --login
Logging in to [iface: default, target: iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.1a7b82ef561a, portal: 192.168.42.135,3260]
Login to [iface: default, target: iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.1a7b82ef561a, portal: 192.168.42.135,3260] successful.

dmesg | tail
[3658097.364033] sd 11:0:0:0: [sdc] Write Protect is off
[3658097.364033] sd 11:0:0:0: [sdc] Mode Sense: 43 00 00 08
[3658097.364559] sd 11:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[3658097.365159] sd 11:0:0:0: [sdc] 12000000 512-byte hardware sectors (6144 MB)
[3658097.365463] sd 11:0:0:0: [sdc] Write Protect is off
[3658097.365463] sd 11:0:0:0: [sdc] Mode Sense: 43 00 00 08
[3658097.365945] sd 11:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA


Create partition
fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf5daec87.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1018, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1018, default 1018):
Using default value 1018

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Create filesystem and mount
mkfs.ext3 /dev/sdc1
mount /dev/sdc1 /mnt/istest

Write test on initiator
dd if=/dev/zero of=/mnt/istest/test1 bs=1024 count=5600000
5600000+0 records in
5600000+0 records out
5734400000 bytes (5.7 GB) copied, 46.0264 s, 125 MB/s

iSCSI reach network interface limit - 1Gbit
CPU usage on iSCSI target

top - 19:07:58 up 50 min,  1 user,  load average: 0.00, 0.01, 0.05
Tasks: 107 total,   2 running, 105 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  7.5 sy,  0.0 ni, 92.4 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem:  10268436 total,  6240584 used,  4027852 free,     9448 buffers
KiB Swap:   561148 total,        0 used,   561148 free,  6138880 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
 3037 root     20   0   0    0    0    R    17.3  0.0   0:03.89 iscsi_trx
 3036 root     20   0   0    0    0    S     1.3  0.0   0:00.28 iscsi_ttx


Tested in virtual machine with 10GB RAM, 2 core (phisycal cpu xeon E5520)



After configuring multipath on client - initiator

sc-srv-006:~# dd if=/dev/zero of=/mnt/istest/test1 bs=1024 count=5600000
5600000+0 records in
5600000+0 records out
5734400000 bytes (5.7 GB) copied, 29.79 s, 192 MB/s

Network statistics from target iSCSI

root@sc-azl-001:~# ethstats
total:     0.01 Mb/s In     0.00 Mb/s Out -     15.0 p/s In       0.0 p/s Out
  eth0:    0.01 Mb/s In     0.00 Mb/s Out -      8.0 p/s In       0.0 p/s Out
  eth1:    0.01 Mb/s In     0.00 Mb/s Out -      7.0 p/s In       0.0 p/s Out
total:     2.04 Mb/s In     0.07 Mb/s Out -    244.9 p/s In      97.8 p/s Out
  eth0:    0.98 Mb/s In     0.04 Mb/s Out -    121.0 p/s In      47.3 p/s Out
  eth1:    1.06 Mb/s In     0.04 Mb/s Out -    123.9 p/s In      50.5 p/s Out
total:   288.21 Mb/s In     1.37 Mb/s Out -  24193.5 p/s In    2389.0 p/s Out
  eth0:  152.06 Mb/s In     0.67 Mb/s Out -  12790.5 p/s In    1154.3 p/s Out
  eth1:  136.15 Mb/s In     0.70 Mb/s Out -  11403.0 p/s In    1234.7 p/s Out
total:  1307.89 Mb/s In     6.22 Mb/s Out - 110060.5 p/s In   10903.6 p/s Out
  eth0:  666.02 Mb/s In     2.97 Mb/s Out -  56061.4 p/s In    5172.4 p/s Out
  eth1:  641.87 Mb/s In     3.25 Mb/s Out -  53999.1 p/s In    5731.2 p/s Out
total:  1286.38 Mb/s In     6.15 Mb/s Out - 108248.9 p/s In   10771.6 p/s Out
  eth0:  642.20 Mb/s In     2.88 Mb/s Out -  54058.7 p/s In    5011.2 p/s Out
  eth1:  644.18 Mb/s In     3.27 Mb/s Out -  54190.2 p/s In    5760.4 p/s Out
total:  1294.30 Mb/s In     6.19 Mb/s Out - 108921.4 p/s In   10854.0 p/s Out
  eth0:  648.03 Mb/s In     2.92 Mb/s Out -  54556.0 p/s In    5089.5 p/s Out
  eth1:  646.27 Mb/s In     3.27 Mb/s Out -  54365.4 p/s In    5764.5 p/s Out
total:   631.95 Mb/s In     3.05 Mb/s Out -  53211.1 p/s In    5316.6 p/s Out
  eth0:  296.08 Mb/s In     1.34 Mb/s Out -  24938.3 p/s In    2310.2 p/s Out

  eth1:  335.87 Mb/s In     1.71 Mb/s Out -  28272.8 p/s In    3006.4 p/s Out

FC target configuration - Targetcli as open source SAN (debian)

Installation on debian wheezy with kernel 3.10.25

Download rpm
apt-get install targetcli 

Or install without recommended packages
apt-get install --no-install-recommends targetcli

Create file for datastore
dd if=/dev/zero of=/opt/test1 bs=1024 count=6000000



targetcli

Create datastore on targetcli
cd backstores/fileio
create itest1 /opt/test1 6144000000B

Create iSCSCI target instance
cd /iscsi
create

Map LUN to datastore (based on FILEIO)
cd luns
create /backstores/fileio/itest1

Configure ACL (check WWN in openiscsi section)
cd ../../acls
create
create iqn.1993-08.org.debian:01:dcb3d359cc91

Save configuration
cd /
saveconfig

Disable athentication
cd iscsi/
set set discovery_auth enable=0
cd /iscsi/iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.8b4b5e8c13a2/tpgt1
set attribute authentication=0

Configure interface
cd portals
create
cd /
saveconfig
All config should looks like:

targetcli
ls
o- / ......................................................................................................... [...]
  o- backstores .............................................................................................. [...]
  | o- fileio ................................................................................... [1 Storage Object]
  | | o- idisk ............................................................................. [/opt/test1 activated]
  | o- iblock ................................................................................... [0 Storage Object]
  | o- pscsi .................................................................................... [0 Storage Object]
  | o- rd_dr .................................................................................... [0 Storage Object]
  | o- rd_mcp ................................................................................... [0 Storage Object]
  o- iscsi .............................................................................................. [1 Target]
  | o- iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.8b4b5e8c13a2 ........................................ [1 TPG]
  |   o- tpgt1 ........................................................................................... [enabled]
  |     o- acls ........................................................................................... [1 ACLs]
  |     | o- iqn.1993-08.org.debian:01:dcb3d359cc91 ................................................. [1 Mapped LUN]
  |     |   o- mapped_lun0 ............................................................................. [lun0 (rw)]
  |     o- luns ............................................................................................ [1 LUN]
  |     | o- lun0 ..................................................................... [fileio/idisk (/home/test1)]
  |     o- portals ...................................................................................... [1 Portal]
  |       o- 192.168.42.135:3260 .............................................................................. [OK]
  o- loopback ........................................................................................... [0 Target]
  o- qla2xxx ............................................................................................ [0 Target]
  o- tcm_fc ............................................................................................. [0 Target]


OpeniSCSI installation - client (initiatior)

aptitude install open-iscsi
/etc/init.d/open-iscsi restart

Search target name:
iscsiadm -m discovery -t sendtargets -p 192.168.42.135

Check your initiator name

cat /etc/iscsi/initiatorname.iscsi
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator.  The InitiatorName must be unique
## for each iSCSI initiator.  Do NOT duplicate iSCSI InitiatorNames.
InitiatorName=iqn.1993-08.org.debian:01:dcb3d359cc91



iscsiadm -m node

Connect to iscsi target:
iscsiadm -m node --targetname "iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.8b4b5e8c13a2" --portal "192.168.42.135:3260" --login

Verify new block device
dmesg | tail

Debian wheezy kernel upgrade to 3.10 installation

Install packages needed to compile:

apt-get install fakeroot build-essential ncurses-dev

Download and unpack kernel

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.25.tar.bz2
tar -xvf linux-3.10.25.tar.bz2
cd linux-3.10.25/

Configure kernel base on old configuration
cat /boot/config-`uname -r` > .config
cat .config
make oldconfig
make menuconfig

Compile kernel

time make deb-pkg -j2

Install
dpkg -i ../linux-firmware-image_3.10.25-1_amd64.deb ../linux-headers-3.10.25_3.10.25-1_amd64.deb ../linux-libc-dev_3.10.25-1_amd64.deb ../linux-image-3.10.25_3.10.25-1_amd64.deb
apt-cache policy linux-libc-dev

restart debian