Skip to content

Commit 8edc699

Browse files
author
Meenachisundaram Velmurugan
committed
adding aws
1 parent e6cbe61 commit 8edc699

File tree

6 files changed

+92
-17
lines changed

6 files changed

+92
-17
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# chef-setup-docker
2-
Docker compose for running Codebox Web IDE and ansible.
1+
# codespace-chef-setup
32

3+
Docker compose for running Codebox Web IDE and chef
44

5-
Create a Mount directory in docker host for Workspace
65

7-
- /mnt/codebox
6+
change the directory
7+
- /codebox
88

99
Run the Docker Compose
10-
10+
1111
- docker-compose up -d
1212

1313
Access Credentials
1414

15-
- http://ip
15+
- http://ip:8000
1616

17-
- username: admin
18-
- password: standard_ic_pass
17+
- username: devops
18+
- password: codespaces

aws/aws.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"variables": {
3+
"aws_access_key": "$akey",
4+
"aws_secret_key": "$skey"
5+
},
6+
"builders": [{
7+
"type": "amazon-ebs",
8+
"access_key": "{{user `aws_access_key`}}",
9+
"secret_key": "{{user `aws_secret_key`}}",
10+
"region": "us-east-1",
11+
"source_ami": "ami-e13739f6",
12+
"instance_type": "t2.micro",
13+
"ssh_username": "ubuntu",
14+
"ami_name": "chef-codespace"
15+
}],
16+
"provisioners": [
17+
{
18+
"type": "file",
19+
"source": "../docker-compose.yml",
20+
"destination": "/tmp/docker-compose.yml"
21+
},
22+
{
23+
"type": "shell",
24+
"scripts": [
25+
"script/update.sh",
26+
"script/custom-script.sh"
27+
]
28+
}
29+
]
30+
}

aws/script/custom-script.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux
4+
5+
# Sample custom configuration script - add your own commands here
6+
# to add some additional commands for your environment
7+
#
8+
# For example:
9+
# yum install -y curl wget git tmux firefox xvfb
10+
sudo su
11+
12+
echo "Installing Docker"
13+
#Installing Docker
14+
sudo apt-get update -y
15+
sudo apt-get install apt-transport-https ca-certificates -y
16+
sudo apt-key adv \
17+
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
18+
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
19+
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
20+
sudo apt-get update -y
21+
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual -y
22+
sudo apt-get install docker-engine -y
23+
sudo usermod -aG docker ubuntu
24+
sudo service docker start
25+
26+
echo "Installing emacs git tree bzip2 ntp telnet inetutils-traceroute nmap"
27+
#Installing emacs git tree bzip2 ntp telnet inetutils-traceroute nmap
28+
sudo apt-get install -y emacs git tree bzip2 ntp telnet inetutils-traceroute nmap
29+
30+
echo "Installing Docker-compose"
31+
#Installing Docker-compose
32+
sudo curl -L "https://github.com/docker/compose/releases/download/1.8.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
33+
34+
sudo chmod +x /usr/bin/docker-compose
35+
36+
echo "copying codespace code"
37+
#copying codespace code
38+
sudo mkdir -p /codespace
39+
sudo cp /tmp/*.yml /codespace/
40+
41+
echo "starting containers"
42+
cd /codespace && sudo docker-compose up -d && touch /tmp/test-`date "+%H:%M:%S"`

aws/script/update.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash -eux
2+
3+
sleep 30
4+
5+
echo "==> Updating list of repositories"
6+
# apt-get update does not actually perform updates, it just downloads and indexes the list of packages
7+
sudo apt-get -y update

packer-ubuntu/custom-script.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@ curl -L "https://github.com/docker/compose/releases/download/1.8.1/docker-compos
3131

3232
chmod +x /usr/bin/docker-compose
3333

34-
echo "Downloading docker images"
35-
#docker pull ubuntu:16.04
36-
docker pull schoolofdevops/chef-controller:v1.2.0
37-
docker pull schoolofdevops/chef-centos6-node:v1.1
38-
#docker pull schoolofdevops/chef-ubuntu14-node:v1.1
39-
4034
echo "copying codespace code"
4135
#copying codespace code
4236
mkdir -p /codespace
4337
cp /tmp/*.yml /codespace/
4438

39+
echo "starting containers"
40+
cd /codespace && sudo docker-compose up -d && touch /tmp/test-`date "+%H:%M:%S"`
41+
4542
echo "modifying in rc.local"
4643
#modifying in rc.local
4744
cat <<EOF > /etc/rc.local

packer-ubuntu/ubuntu.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"passwd/user-password={{ user `ssh_password` }} ",
109109
"passwd/user-password-again={{ user `ssh_password` }} ",
110110
"passwd/username={{ user `ssh_username` }} ",
111-
"initrd=/install/initrd.gz -- <wait><enter>"
111+
"initrd=/install/initrd.gz -- <wait><enter>"
112112
],
113113
"disk_size": "{{ user `disk_size` }}",
114114
"floppy_files": [
@@ -143,7 +143,7 @@
143143
],
144144
"post-processors": [
145145
{
146-
"keep_input_artifact": false,
146+
"keep_input_artifact": true,
147147
"output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box",
148148
"type": "vagrant",
149149
"vagrantfile_template": "{{ user `vagrantfile_template` }}"
@@ -221,4 +221,3 @@
221221
"vmware_guest_os_type": "ubuntu-64"
222222
}
223223
}
224-

0 commit comments

Comments
 (0)