Skip to content

Commit 633054d

Browse files
author
Meenachisundaram Velmurugan
committed
adding aws
1 parent ef4e5a7 commit 633054d

File tree

6 files changed

+103
-9
lines changed

6 files changed

+103
-9
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
## Codespace for Docker
1+
# codespace-docker-setup
2+
3+
Docker compose for running Codebox Web IDE and docker
4+
5+
6+
change the directory
7+
- /codebox
8+
9+
Run the Docker Compose
10+
11+
- docker-compose up -d
12+
13+
Access Credentials
14+
15+
- http://ip:8000
16+
17+
- username: devops
18+
- password: codespaces

aws/aws.json

Lines changed: 30 additions & 0 deletions
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": "docker-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

Lines changed: 42 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@ 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/docker-controller:v1.0
37-
3834
echo "copying codespace code"
3935
#copying codespace code
4036
mkdir -p /codespace
4137
cp /tmp/*.yml /codespace/
4238

39+
echo "starting containers"
40+
cd /codespace && sudo docker-compose up -d && touch /tmp/test-`date "+%H:%M:%S"`
41+
4342
echo "modifying in rc.local"
4443
#modifying in rc.local
4544
cat <<EOF > /etc/rc.local
46-
#!/bin/sh -e
45+
#!/bin/bash
4746
#
4847
# rc.local
4948
#

packer-ubuntu/ubuntu.json

Lines changed: 2 additions & 3 deletions
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)