File tree 9 files changed +72
-4
lines changed
9 files changed +72
-4
lines changed Original file line number Diff line number Diff line change
1
+ # make build direcotories
1
2
build
3
+
4
+ # local environment files, which contain secrets
2
5
/env /environment.osx
6
+
7
+ # temporary local terraform
3
8
/terraform /.terraform
4
9
/terraform /* .tfstate
5
10
/terraform /terraform.tfstate.backup
11
+
12
+ # docker configuration file, contains secrets
6
13
/ansible /roles /docker /files /dockercfg.json
14
+
15
+ # failed ansible playbooks
16
+ * .retry
Original file line number Diff line number Diff line change @@ -114,6 +114,19 @@ mongodbnode-01 | SUCCESS => {
114
114
}
115
115
116
116
```
117
+
118
+ # destroying the infrastructure
119
+ (be carefull ;)
120
+ If you want to destroy the infrasctructure, use:
121
+ ```
122
+ make destroy
123
+ ```
124
+ The command will wipe the complete infrastructure. You can also be more specific. If you want for example to create new dockerhosts, you can use:
125
+ ```
126
+ terraform destroy --target module.mongodbnodes.aws_instance.dockernodes
127
+ ```
128
+
129
+
117
130
# provisioning of the hosts
118
131
119
132
All the hosts can be provisioned using:
@@ -122,10 +135,15 @@ All the hosts can be provisioned using:
122
135
ansible-playbook -i terraform/bin/terraform.py/terraform.py ansible/pegski.yml
123
136
```
124
137
138
+ There also the possibility to be more specific:
139
+
140
+ ```
141
+ ansible-playbook -i terraform/bin/terraform.py/terraform.py ansible/pegski.yml --limit "role=dockernodes"
142
+ ```
125
143
126
144
## left todo:
127
145
128
- * create ansible playbook for provisioning mongodb
146
+ * fix security groups, permissions are to wide now while dockernodes cannot access mongodb
129
147
* setup memcached
130
148
* refactor dockerfiles
131
149
* files should be loaded in docker container
Original file line number Diff line number Diff line change 10
10
roles :
11
11
- {role: base, tags: ['base']}
12
12
- {role: ssh_access, tags: ['ssh_access']}
13
+ - {role: mongodb, tags: ['mongodb']}
Original file line number Diff line number Diff line change
1
+ # Ubuntu upstart file at /etc/init/mongod_vm_settings.conf
2
+ #
3
+ # This file will set the correct kernel VM settings for MongoDB
4
+ # This file is maintained in Ansible
5
+
6
+ start on (starting mongod)
7
+ script
8
+ echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
9
+ echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
10
+ end script
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : start mongodb
3
+ service : name=mongod state=started
Original file line number Diff line number Diff line change
1
+ # This is a very basic playbook for installing mongodb.
2
+ # If we want something more advanced, we might consider using
3
+ # https://github.com/UnderGreen/ansible-role-mongodb
4
+ ---
5
+ - name : import the public key used by the package management system
6
+ apt_key : keyserver=hkp://keyserver.ubuntu.com:80 id=EA312927 state=present
7
+
8
+ - name : add MongoDB repository
9
+ apt_repository : repo='deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse' state=present
10
+
11
+ - name : set correct (advised by mongodb) kernelsettings
12
+ copy :
13
+ src : mongo_vm_settings.conf
14
+ dest : " /etc/init/mongod_vm_settings.conf"
15
+
16
+ - name : install mongodb
17
+ apt : pkg=mongodb-org state=latest update_cache=yes
18
+ notify :
19
+ - start mongodb
20
+
21
+ - name : check if mongodb is running and accepting connections
22
+ wait_for :
23
+ port : 27017
24
+ timeout : 10
Original file line number Diff line number Diff line change @@ -28,5 +28,5 @@ variable "zones" {
28
28
29
29
variable "dockernode_count" {
30
30
type = " string"
31
- default = " 1 "
31
+ default = " 2 "
32
32
}
Original file line number Diff line number Diff line change @@ -6,13 +6,14 @@ variable "secret_key" {
6
6
type = " string"
7
7
}
8
8
9
- # the name of the AWS keypair
9
+ # the name of the AWS keypair (will be created in ec2), make sure you own the
10
+ # private key of this keypar
10
11
variable "key_name" {
11
12
type = " string"
12
13
default = " merlijn"
13
14
}
14
15
15
- # path to the local public key of the AWS keypair
16
+ # path to the local public key of the AWS keypair which will be uploaded to ec2
16
17
variable "public_key_path" {
17
18
type = " string"
18
19
}
Original file line number Diff line number Diff line change 1
1
# define the vpc
2
2
resource "aws_vpc" "main" {
3
3
cidr_block = " 10.0.0.0/16"
4
+ enable_dns_hostnames = true
4
5
5
6
tags {
6
7
Name = " pegski-vpc"
You can’t perform that action at this time.
0 commit comments