Browse Source

Added sample express app and ansible playbook

Priya Samuel 2 years ago
parent
commit
e61be58079

+ 2 - 0
ansible/.gitignore

@@ -0,0 +1,2 @@
1
+node_modules
2
+build

+ 7 - 0
ansible/README.md

@@ -0,0 +1,7 @@
1
+Install Ansible:
2
+---------------
3
+pip install -r requirements.txt
4
+
5
+Run playbook:
6
+-------------
7
+ansible-playbook playbook.yml --check -i hosts

+ 10 - 0
ansible/container.yml

@@ -0,0 +1,10 @@
1
+version: "2"
2
+services:
3
+  web:
4
+    image: "ubuntu:trusty"
5
+    ports:
6
+      - "80:80"
7
+    command: ["/usr/bin/dumb-init", "/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
8
+    dev_overrides:
9
+      environment:
10
+        - "DEBUG=1"

+ 2 - 0
ansible/hosts

@@ -0,0 +1,2 @@
1
+[webservers]
2
+ec2-54-246-251-113.eu-west-1.compute.amazonaws.com

+ 10 - 0
ansible/myapp/app.js

@@ -0,0 +1,10 @@
1
+var express = require('express')
2
+var app = express()
3
+
4
+app.get('/', function (req, res) {
5
+  res.send('Hello World!')
6
+})
7
+
8
+app.listen(3000, function () {
9
+  console.log('Example app listening on port 3000!')
10
+})

+ 17 - 0
ansible/myapp/package.json

@@ -0,0 +1,17 @@
1
+{
2
+  "name": "myapp",
3
+  "version": "0.0.0",
4
+  "private": true,
5
+  "scripts": {
6
+    "start": "node app.js",
7
+    "build": "rm -rf build && mkdir build && tar -cvzf build/my-app.tar.gz --exclude='node_modules' --exclude='build' *"
8
+  },
9
+  "dependencies": {
10
+    "express": "^4.15.2"
11
+  },
12
+  "main": "app.js",
13
+  "devDependencies": {},
14
+  "author": "",
15
+  "license": "ISC",
16
+  "description": ""
17
+}

+ 23 - 0
ansible/npm-debug.log

@@ -0,0 +1,23 @@
1
+0 info it worked if it ends with ok
2
+1 verbose cli [ '/Users/psamuel/.nvm/versions/node/v7.5.0/bin/node',
3
+1 verbose cli   '/Users/psamuel/.nvm/versions/node/v7.5.0/bin/npm',
4
+1 verbose cli   'run',
5
+1 verbose cli   'build' ]
6
+2 info using npm@4.1.2
7
+3 info using node@v7.5.0
8
+4 verbose config Skipping project config: /Users/psamuel/.npmrc. (matches userconfig)
9
+5 verbose stack Error: ENOENT: no such file or directory, open '/Users/psamuel/package.json'
10
+6 verbose cwd /Users/psamuel/decode/spikes/ansible
11
+7 error Darwin 15.4.0
12
+8 error argv "/Users/psamuel/.nvm/versions/node/v7.5.0/bin/node" "/Users/psamuel/.nvm/versions/node/v7.5.0/bin/npm" "run" "build"
13
+9 error node v7.5.0
14
+10 error npm  v4.1.2
15
+11 error path /Users/psamuel/package.json
16
+12 error code ENOENT
17
+13 error errno -2
18
+14 error syscall open
19
+15 error enoent ENOENT: no such file or directory, open '/Users/psamuel/package.json'
20
+16 error enoent ENOENT: no such file or directory, open '/Users/psamuel/package.json'
21
+16 error enoent This is most likely not a problem with npm itself
22
+16 error enoent and is related to npm not being able to find a file.
23
+17 verbose exit [ -2, true ]

+ 2 - 0
ansible/playbook.yml

@@ -0,0 +1,2 @@
1
+- hosts: webservers
2
+  remote_user: ec2-user

+ 44 - 0
ansible/requirements.txt

@@ -0,0 +1,44 @@
1
+ansible==2.3.0.0
2
+ansible-container==0.3.0
3
+appdirs==1.4.3
4
+asn1crypto==0.22.0
5
+awscli==1.11.76
6
+backports.ssl-match-hostname==3.5.0.1
7
+botocore==1.5.39
8
+cached-property==1.3.0
9
+cffi==1.10.0
10
+colorama==0.3.7
11
+cryptography==1.8.1
12
+docker-compose==1.9.0
13
+docker-py==1.10.6
14
+docker-pycreds==0.2.1
15
+dockerpty==0.4.1
16
+docopt==0.6.2
17
+docutils==0.13.1
18
+enum34==1.1.6
19
+functools32==3.2.3.post2
20
+futures==3.0.5
21
+idna==2.5
22
+ipaddress==1.0.18
23
+Jinja2==2.9.6
24
+jmespath==0.9.2
25
+jsonschema==2.6.0
26
+MarkupSafe==1.0
27
+mercurial==3.9.1
28
+packaging==16.8
29
+paramiko==2.1.2
30
+py==1.4.32
31
+pyasn1==0.2.3
32
+pycparser==2.17
33
+pycrypto==2.6.1
34
+pyparsing==2.2.0
35
+pytest==3.0.5
36
+python-dateutil==2.6.0
37
+PyYAML==3.12
38
+requests==2.11.1
39
+rsa==3.4.2
40
+s3transfer==0.1.10
41
+six==1.10.0
42
+texttable==0.8.8
43
+virtualenv==13.1.2
44
+websocket-client==0.40.0