Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
16de986
add ciscripts.
hansode May 13, 2015
42cec2d
add instance-wait4ssh.sh.
hansode May 13, 2015
d111052
show instance_id only.
hansode May 13, 2015
bce7e54
disable user_data and vif.
hansode May 13, 2015
3d5fb49
fix to get ipaddr.
hansode May 13, 2015
1c1baef
Merge pull request #1 from axsh/master
hansode May 14, 2015
60a9b70
Merge branch 'master' into ciscripts
hansode May 14, 2015
8264fd0
add create-lbapp.sh and create-lbweb.sh.
hansode May 14, 2015
7517b53
add retry.
hansode May 14, 2015
fa6313c
add error trap.
hansode May 14, 2015
7a3e81a
add error trap.
hansode May 14, 2015
e2d2d8a
use latest open_port()?.
hansode May 14, 2015
ec2e2e3
add instance-kill.sh.
hansode May 14, 2015
11fc0a0
add instance-exec.sh.
hansode May 14, 2015
e8e13b0
add demokeypair.
hansode May 14, 2015
fe6d0c9
add provision-db.sh.
hansode May 14, 2015
0298411
add ./instance-get-ipaddr.sh.
hansode May 14, 2015
6ac549f
update db config.
hansode May 14, 2015
185dfa4
add runner-db.sh.
hansode May 14, 2015
1f96266
add provision-app.sh.
hansode May 14, 2015
7df17d6
show instance_id.
hansode May 14, 2015
25816cf
adjust redirect.
hansode May 14, 2015
042991d
show ipaddr.
hansode May 14, 2015
639ba38
specify user_data file path.
hansode May 14, 2015
e023168
generate user_data_app.txt.
hansode May 14, 2015
d4e625d
load user_data.
hansode May 14, 2015
e59de61
debug user_data.
hansode May 14, 2015
95353e8
fix create.sh path.
hansode May 14, 2015
d3c836b
use centos in app.
hansode May 14, 2015
0f77cc8
remove debug code.
hansode May 14, 2015
4106e8c
add myaddr.sh.
hansode May 14, 2015
3664de3
add parameter check.
hansode May 14, 2015
b9c4d09
Merge pull request #2 from axsh/master
hansode May 14, 2015
7606ccb
Merge branch 'master' into ciscripts
hansode May 14, 2015
90ca224
deploy repofile.
hansode May 14, 2015
15dc2b0
test repolist.
hansode May 14, 2015
8a92081
replace yum rpeo host.
hansode May 14, 2015
6b03e01
install rpm.
hansode May 14, 2015
fae4c33
install epel.
hansode May 15, 2015
f7fbc78
install ruby-2.0.0p598.
hansode May 15, 2015
9f824a3
replace dbhost.
hansode May 15, 2015
ffc5045
fix image id.
hansode May 15, 2015
3e02a3a
use metadata.
hansode May 15, 2015
0d9ac22
add web3layers-ci.sh.
hansode May 15, 2015
ece4925
add README.md.
hansode May 15, 2015
9c80891
Added Unit test README.
t-iwano May 20, 2015
cc40710
Update Unit test README.
t-iwano May 20, 2015
264518d
Added tiny web example README.
t-iwano May 21, 2015
e5658f4
Fixed list information.
t-iwano May 22, 2015
da2387a
Update tiny web example README.
t-iwano May 22, 2015
88898f6
Fixed directory path.
t-iwano May 22, 2015
7e42687
Remove duplication information.
t-iwano May 22, 2015
36e630b
Added Configure database uri.
t-iwano May 22, 2015
17389e7
Added Integration test README.
t-iwano May 22, 2015
6f50be9
Added rpmbuild README.
t-iwano May 22, 2015
4937fab
Added quote.
t-iwano May 22, 2015
b18b41c
Changed wording.
t-iwano May 22, 2015
0a28ae0
Merge pull request #7 from axsh/add-readme
t-iwano May 22, 2015
6d27c9f
Merge pull request #3 from axsh/master
hansode May 25, 2015
2c076e0
use wmi-centos1d64.
hansode May 25, 2015
be09b5b
add rbenv set.
hansode May 25, 2015
ae7b3e8
update app set.
hansode May 25, 2015
4a7c7cd
remove unused user_data.
hansode May 25, 2015
c2d9f9d
use/include retry.sh.
hansode May 25, 2015
f7bab3e
add "img" prefix.
hansode May 25, 2015
a04a4a8
add "img" prefix to display name.
hansode May 25, 2015
8743cdf
Fixed quote.
t-iwano May 25, 2015
6eb5705
Added curl options.
t-iwano May 25, 2015
447bac3
use retry.sh.
hansode May 25, 2015
08ead5a
Merge pull request #9 from axsh/fix-tiny-web-example-readme
t-iwano May 25, 2015
9dc5639
add scripts for new image operation.
hansode May 25, 2015
77f9810
add instance-backup.sh.
hansode May 25, 2015
876ff5b
add image-destroy.sh.
hansode May 25, 2015
b2314e3
replace "./" with "${BASH_SOURCE[0]%/*}/".
hansode May 25, 2015
3d86ee5
add db set.
hansode May 25, 2015
d39f7cb
add YUM_HOST and DB_HOST as required params.
hansode May 25, 2015
ade1710
mem_size: 1024 -> 512
hansode May 25, 2015
6eb2232
use lazy replacing.
hansode May 25, 2015
cd05b65
use string check with egrep.
hansode May 25, 2015
8111d7f
add double-quotes.
hansode May 25, 2015
5fdd80e
update image_id.
hansode May 25, 2015
9cbfa3e
graceful shutdown mysqld.
hansode May 25, 2015
423e748
add smoketest-app.sh.
hansode May 25, 2015
f32412e
update ci script.
hansode May 25, 2015
f1412dd
add simple http get testing.
hansode May 25, 2015
6d40d92
add error trap.
hansode May 25, 2015
21345eb
fix typo.
hansode May 25, 2015
28ca786
wait for expected state.
hansode May 25, 2015
cf9993b
Merge pull request #4 from axsh/master
hansode May 25, 2015
a465dfb
disable force poweroff.
hansode May 26, 2015
45b2db0
Merge branch 'master' into ciscripts
hansode May 26, 2015
d1352e0
create "wakame-vdc" folder.
hansode May 26, 2015
b6fdd21
export musselrc generation procedure to gen-musselrc.sh.
hansode May 26, 2015
e198378
export vifs.json generation procedure to gen-vifs.sh.
hansode May 26, 2015
7f6f54d
organize code layout.
hansode May 26, 2015
0b7f28c
organize code layout.
hansode May 26, 2015
63d8652
organize code layout.
hansode May 26, 2015
a5edd7b
update README.
hansode May 26, 2015
53a7b98
add .gitignore.
hansode May 26, 2015
234ed8e
handle runner mode.
hansode May 26, 2015
941c743
mode: 644 -> 755
hansode May 26, 2015
13b3acd
Merge pull request #10 from axsh/fix-file-attribute
hansode May 26, 2015
faa6e64
Merge pull request #5 from axsh/master
hansode May 26, 2015
f62dc29
Merge branch 'master' into ciscripts
hansode May 26, 2015
01a8e8a
add integration-test.sh.
hansode May 26, 2015
97bed19
Merge pull request #11 from axsh/feature-integration-test-runner
hansode May 26, 2015
01fd91f
Merge pull request #6 from axsh/master
hansode May 26, 2015
5ee2359
Merge branch 'master' into ciscripts
hansode May 26, 2015
c7b7455
add runner-lb*.sh.
hansode May 26, 2015
b0de309
show app-instance vif.
hansode May 26, 2015
4caf6ef
add load_balancer scripts.
hansode May 26, 2015
c50fc68
add load_balancer-register/unregister-instance.
hansode May 26, 2015
2206da8
remove vif from output.
hansode May 26, 2015
875d1d9
add "-vif".
hansode May 26, 2015
39f4bee
add runner-lbapp/lbweb.
hansode May 26, 2015
ede187b
add web3layers-lite.sh.
hansode May 26, 2015
80a0f42
add lbapp.
hansode May 26, 2015
2b87b59
wait for lb-port to be ready.
hansode May 26, 2015
6e3e777
remove testing for web.
hansode May 26, 2015
5eacd23
add smoketest-web.sh.
hansode May 26, 2015
fbce1d6
replace lbapp with lbweb.
hansode May 26, 2015
69bc1b9
remove "-x".
hansode May 26, 2015
8a41c94
run smoketest-web.sh.
hansode May 26, 2015
82a4881
disable mode handling by caller.
hansode May 26, 2015
6e65106
db_id -> DB_ID
hansode May 27, 2015
56785d5
app_id -> APP_ID
hansode May 27, 2015
fcc10e9
ldweb_id -> LDWEB_ID
hansode May 27, 2015
fb46461
improve trap quote.
hansode May 27, 2015
6ed5483
move common procedures to setup-*.sh.
hansode May 27, 2015
f850194
add parameter validation.
hansode May 27, 2015
5de0e31
remove unnecessary lbweb setup.
hansode May 27, 2015
9b54146
runner-* -> run-*.
hansode May 27, 2015
f93f455
replace source with fork.
hansode May 27, 2015
361af3d
use proper message.
hansode May 27, 2015
a5b0b20
reenable mode handling.
hansode May 27, 2015
8a1c15f
enable to set specified app host.
hansode May 27, 2015
9fdfdc0
run rspec based integration test.
hansode May 27, 2015
6e84426
change directory before running integration-test.sh.
hansode May 27, 2015
37a3b3f
fix syntax error.
hansode May 27, 2015
9c018f7
move web smoketest.
hansode May 27, 2015
f849c14
update comment.
hansode May 27, 2015
ef10bab
update readme.
hansode May 27, 2015
5f2d166
remove static image_id.
hansode May 27, 2015
c15b3b3
add config/.gitkeep.
hansode May 27, 2015
2181684
enable to load instance specific params.
hansode May 27, 2015
11bc375
update display_name for lb.
hansode May 27, 2015
7067073
add IMAGE_ID.
hansode May 27, 2015
6d37c3d
add DB_IMAGE_ID APP_IMAGE_ID.
hansode May 27, 2015
8a5a7fb
update readme.
hansode May 27, 2015
4e272d1
Update README.md
hansode May 27, 2015
979e6ae
Merge pull request #12 from hansode/ciscripts
hansode May 27, 2015
83125d8
Remove duplication code.
t-iwano May 28, 2015
a7b8905
Added image build scripts.
t-iwano May 28, 2015
964fcaf
Remove yum host check.
t-iwano May 29, 2015
a6f6e5c
Fixed image-build.sh.
t-iwano May 29, 2015
8f544a2
Added description.
t-iwano May 29, 2015
a9abc35
Merge pull request #13 from axsh/fix-ciscripts
t-iwano May 29, 2015
b8cd02f
Added file write.
t-iwano May 29, 2015
66932c0
Added README for Image Build.
t-iwano May 29, 2015
922f522
Merge pull request #14 from axsh/add-image-build-readme
t-iwano May 29, 2015
0616f18
Fix explanation of integration-test
zonomasa May 30, 2015
88eb7df
Merge pull request #21 from zonomasa/fix3
hansode May 31, 2015
9a7c96b
Use openvz as hypervisor
toros11 Mar 1, 2016
901e323
Changed host settings to work with 1box
toros11 May 13, 2016
3545afc
Merge pull request #23 from axsh/openvz2
toros11 May 13, 2016
540d53d
Merge pull request #22 from axsh/fix-host-address
toros11 May 13, 2016
fbd8368
Added libcurl package
t-iwano May 23, 2017
ba1d15f
Fixed ruby version
t-iwano May 23, 2017
15b3021
Merge pull request #38 from axsh/fix-appimage-build
t-iwano May 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
648 changes: 648 additions & 0 deletions README.md

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions ciscripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Image Build

シェルスクリプトに下記内容を定義してください。

```
#!/bin/bash
#
#
set -e
set -o pipefail
set -u
set -x
cd ciscripts

WRITE_FILE=${WORKSPACE}/${BUILD_TAG} IMAGE_ID=${image_id} YUM_HOST=${yum_host} ./image-build.sh
```

## JenkinsCI

シェルジョブに下記内容を定義して下さい。
なお、`APP_IMAGE_ID`と`DB_IMAGE_ID`には、それぞれ新規作成したマシンイメージIDで置き換えて下さい。

```
#!/bin/bash
#
#
set -e
set -o pipefail
set -u
set -x

cd ciscripts
ls -l

ipaddr="$(< /metadata/meta-data/local-ipv4)"

APP_IMAGE_ID="wmi-********" \
DB_IMAGE_ID="wmi-********" \
YUM_HOST="${ipaddr}" \
./web3layers-ci.sh
```
Empty file modified ciscripts/create-repo.sh
100644 → 100755
Empty file.
176 changes: 176 additions & 0 deletions ciscripts/image-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#!/bin/bash
#
#
set -e
set -o pipefail
set -u

# required shell params

: "${IMAGE_ID:?"should not be empty"}"
: "${YUM_HOST:?"should not be empty"}"
: "${WRITE_FILE:?"shoud not be empty"}"

cd ${BASH_SOURCE[0]%/*}/wakame-vdc

# wait for the instance to be running
. ${BASH_SOURCE[0]%/*}/retry.sh

# vifs
network_id="nw-demo1"
security_group_id="sg-cicddemo"
vifs="vifs.json"

# instance-specific parameter
cpu_cores="1"
hypervisor="openvz"
memory_size="512"
image_id="${IMAGE_ID}"
ssh_key_id="ssh-cicddemo"

# create an musselrc
cat <<EOS > ~/.musselrc
DCMGR_HOST=10.0.2.2
account_id=a-shpoolxx
EOS

# create an vifs
cat <<EOS > "${vifs}"
{
"eth0":{"network":"${network_id}","security_groups":"${security_group_id}"}
}
EOS

## create database image

# db display name
display_name="db"

# create an instance
instance_id="$(
mussel instance create \
--cpu-cores "${cpu_cores}" \
--hypervisor "${hypervisor}" \
--image-id "${image_id}" \
--memory-size "${memory_size}" \
--ssh-key-id "${ssh_key_id}" \
--vifs "${vifs}" \
--display-name "${display_name}" \
| egrep ^:id: | awk '{print $2}'
)"
: "${instance_id:?"should not be empty"}"
echo "${instance_id} is initializing..."

trap 'mussel instance destroy "${instance_id}"' ERR

# wait for the instance to be running
retry_until [[ '"$(mussel instance show "${instance_id}" | egrep -w "^:state: running")"' ]]
echo "${instance_id} is running"

# get instance ipaddr
ipaddr="$(
mussel instance show "${instance_id}" \
| egrep :address: \
| awk '{print $2}' \
| tr '\n' ','
)"
: "${ipaddr:?"should not be empty"}"
ipaddr="${ipaddr%%,}"
echo "${instance_id} ipaddr: ${ipaddr}"

# wait for ssh to be ready
${BASH_SOURCE[0]%/*}/instance-wait4ssh.sh "${instance_id}"

# install package
${BASH_SOURCE[0]%/*}/instance-exec.sh "${instance_id}" < ${BASH_SOURCE[0]%/*}/provision-imgdb.sh

# instance state: running -> halted
mussel instance poweroff --force false ${instance_id}
echo "${instance_id} is halting"

# wait for the instance to be halted
retry_until [[ '"$(mussel instance show "${instance_id}" | egrep -w "^:state: halted")"' ]]
echo "${instance_id} is halted"

# instance backup
DB_IMAGE_ID="$(mussel instance backup ${instance_id} --display-name db | egrep ^:image_id: | awk '{print $2}')"
echo "database image id: ${DB_IMAGE_ID}"

# wait for the image to be available
retry_until [[ '"$(mussel image show "${DB_IMAGE_ID}" | egrep -w "^:state: available")"' ]]
echo "${DB_IMAGE_ID} is available"

# instance destroy
mussel instance destroy "${instance_id}"
echo "${instance_id} is deleted"

## create app image

# app display name
display_name="app"

# create an instance
instance_id="$(
mussel instance create \
--cpu-cores "${cpu_cores}" \
--hypervisor "${hypervisor}" \
--image-id "${image_id}" \
--memory-size "${memory_size}" \
--ssh-key-id "${ssh_key_id}" \
--vifs "${vifs}" \
--display-name "${display_name}" \
| egrep ^:id: | awk '{print $2}'
)"
: "${instance_id:?"should not be empty"}"
echo "${instance_id} is initializing..."

trap 'mussel instance destroy "${instance_id}"' ERR

# wait for the instance to be running
retry_until [[ '"$(mussel instance show "${instance_id}" | egrep -w "^:state: running")"' ]]
echo "${instance_id} is running"

# get instance ipaddr
ipaddr="$(
mussel instance show "${instance_id}" \
| egrep :address: \
| awk '{print $2}' \
| tr '\n' ','
)"
: "${ipaddr:?"should not be empty"}"
ipaddr="${ipaddr%%,}"
echo "${instance_id} ipaddr: ${ipaddr}"

# wait for ssh to be ready
${BASH_SOURCE[0]%/*}/instance-wait4ssh.sh "${instance_id}"

# install package
${BASH_SOURCE[0]%/*}/instance-exec.sh "${instance_id}" \
YUM_HOST="${YUM_HOST}" \
bash -l < ${BASH_SOURCE[0]%/*}/provision-imgapp.sh

# instance state: running -> halted
mussel instance poweroff --force false ${instance_id}
echo "${instance_id} is halting"

# wait for the instance to be halted
retry_until [[ '"$(mussel instance show "${instance_id}" | egrep -w "^:state: halted")"' ]]
echo "${instance_id} is halted"

# instance backup
APP_IMAGE_ID="$(mussel instance backup ${instance_id} --display-name app | egrep ^:image_id: | awk '{print $2}')"
echo "app image id: ${APP_IMAGE_ID}"

# wait for the image to be available
RETRY_WAIT_SEC=180 retry_until [[ '"$(mussel image show "${APP_IMAGE_ID}" | egrep -w "^:state: available")"' ]]
echo "${DB_IMAGE_ID} is available"

# instance destroy
mussel instance destroy "${instance_id}"
echo "${instance_id} is deleted"

echo DB_IMAGE_ID="${DB_IMAGE_ID}"
echo APP_IMAGE_ID="${APP_IMAGE_ID}"

echo "DB_IMAGE_ID=${DB_IMAGE_ID}" > ${WRITE_FILE}
echo "APP_IMAGE_ID=${APP_IMAGE_ID}" >> ${WRITE_FILE}
17 changes: 17 additions & 0 deletions ciscripts/integration-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#
#
set -e
set -x
set -o pipefail

cd spec_integration

bundle install
cp config/webapi.conf.example config/webapi.conf

if [[ -n "${APP_HOST:-""}" ]]; then
sed -i s,localhost,${APP_HOST}, config/webapi.conf
fi

bundle exec rspec ./spec/webapi_integration_spec.rb
Empty file modified ciscripts/rpm-build.sh
100644 → 100755
Empty file.
Empty file modified ciscripts/unit-test.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions ciscripts/wakame-vdc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vifs.json
13 changes: 13 additions & 0 deletions ciscripts/wakame-vdc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Script Chain

1. run `setup-db.sh`
1. run `run-db.sh`
1. run `create-db.sh`
2. run `provision-db.sh`
2. run `setup-app.sh`
1. run `run-app.sh`
1. run `create-app.sh`
2. run `provision-app.sh`
3. run `setup-lbweb.sh`
1. run `run-lbweb.sh`
1. run `create-lbweb.sh`
Empty file.
57 changes: 57 additions & 0 deletions ciscripts/wakame-vdc/create-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
#
set -e
set -o pipefail
set -u

: "${IMAGE_ID:?"should not be empty"}"

# vifs

network_id="nw-demo1"
security_group_id="sg-cicddemo"
vifs="vifs.json"

# instance-specific parameter

cpu_cores="1"
hypervisor="openvz"
memory_size="1024"
image_id="${IMAGE_ID}"
display_name="app"
ssh_key_id="ssh-cicddemo"

#

if [[ -f ${BASH_SOURCE[0]%/*}/config/${display_name} ]]; then
. ${BASH_SOURCE[0]%/*}/config/${display_name}
fi

## create an instance

${BASH_SOURCE[0]%/*}/gen-musselrc.sh
vifs="${vifs}" network_id="${network_id}" security_group_id="${security_group_id}" \
${BASH_SOURCE[0]%/*}/gen-vifs.sh

instance_id="$(
mussel instance create \
--cpu-cores "${cpu_cores}" \
--hypervisor "${hypervisor}" \
--image-id "${image_id}" \
--memory-size "${memory_size}" \
--ssh-key-id "${ssh_key_id}" \
--vifs "${vifs}" \
--display-name "${display_name}" \
| egrep ^:id: | awk '{print $2}'
)"
: "${instance_id:?"should not be empty"}"
echo "${instance_id} is initializing..." >&2

trap 'mussel instance destroy "${instance_id}"' ERR

## wait for the instance to be running

. ${BASH_SOURCE[0]%/*}/retry.sh

retry_until [[ '"$(mussel instance show "${instance_id}" | egrep -w "^:state: running")"' ]]
echo instance_id="${instance_id}"
55 changes: 55 additions & 0 deletions ciscripts/wakame-vdc/create-centos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
#
set -e
set -o pipefail
set -u

# setup vifs.json

network_id="nw-demo1"
security_group_id="sg-cicddemo"
vifs="vifs.json"

# instance-specific parameter

cpu_cores="1"
hypervisor="openvz"
memory_size="1024"
image_id="wmi-centos1d64"
display_name="centos"
ssh_key_id="ssh-cicddemo"

#

if [[ -f ${BASH_SOURCE[0]%/*}/config/${display_name} ]]; then
. ${BASH_SOURCE[0]%/*}/config/${display_name}
fi

## create an instance

${BASH_SOURCE[0]%/*}/gen-musselrc.sh
vifs="${vifs}" network_id="${network_id}" security_group_id="${security_group_id}" \
${BASH_SOURCE[0]%/*}/gen-vifs.sh

instance_id="$(
mussel instance create \
--cpu-cores "${cpu_cores}" \
--hypervisor "${hypervisor}" \
--image-id "${image_id}" \
--memory-size "${memory_size}" \
--ssh-key-id "${ssh_key_id}" \
--vifs "${vifs}" \
--display-name "${display_name}" \
| egrep ^:id: | awk '{print $2}'
)"
: "${instance_id:?"should not be empty"}"
echo "${instance_id} is initializing..." >&2

trap 'mussel instance destroy "${instance_id}"' ERR

## wait for the instance to be running

. ${BASH_SOURCE[0]%/*}/retry.sh

retry_until [[ '"$(mussel instance show "${instance_id}" | egrep -w "^:state: running")"' ]]
echo instance_id="${instance_id}"
Loading