forked from digital-wonderland/docker-logstash-forwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user-data
148 lines (133 loc) · 4.72 KB
/
user-data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#cloud-config
coreos:
etcd:
#generate a new token for each unique cluster from https://discovery.etcd.io/new
#discovery: https://discovery.etcd.io/<token>
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
runtime: no
content: |
[Unit]
Description=fleet
[Service]
Environment=FLEET_PUBLIC_IP=$public_ipv4
ExecStart=/usr/bin/fleet
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
Service=docker.service
BindIPv6Only=both
[Install]
WantedBy=sockets.target
- name: elasticsearch.service
command: start
enable: true
content: |
[Unit]
Description=Elasticsearch
Documentation=http://www.elasticsearch.org
After=docker.service
Requires=docker.service
[Service]
EnvironmentFile=/etc/environment
LimitNOFILE=65535
ExecStartPre=/usr/bin/docker pull digitalwonderland/elasticsearch
TimeoutStartSec=0
ExecStart=/bin/bash -c '/usr/bin/docker start -a elasticsearch || /usr/bin/docker run --name elasticsearch -p 9200:9200 digitalwonderland/elasticsearch -Des.http.cors.enabled=true'
TimeoutStopSec=30
ExecStop=/usr/bin/docker stop elasticsearch
[Install]
WantedBy=multi-user.target
[X-Fleet]
X-Conflicts=elasticsearch.service
- name: logstash.service
command: start
enable: true
content: |
[Unit]
Description=Logstash
Documentation=http://logstash.net
After=docker.service
Requires=docker.service
After=elasticsearch.service
Requires=elasticsearch.service
[Service]
EnvironmentFile=/etc/environment
ExecStartPre=/usr/bin/docker pull digitalwonderland/logstash
TimeoutStartSec=0
ExecStart=/bin/bash -c '/usr/bin/docker start -a logstash || /usr/bin/docker run --name logstash -p 5043:5043 --link elasticsearch:elasticsearch digitalwonderland/logstash'
TimeoutStopSec=30
ExecStop=/usr/bin/docker stop logstash
[Install]
WantedBy=multi-user.target
[X-Fleet]
X-Conflicts=logstash.service
- name: logstash-forwarder.service
command: start
enable: true
content: |
[Unit]
Description=Logstash Forwarder
Documentation=https://github.com/digital-wonderland/docker-logstash-forwarder
After=docker.service
Requires=docker.service
After=logstash.service
Requires=logstash.service
[Service]
EnvironmentFile=/etc/environment
ExecStartPre=/usr/bin/docker pull digitalwonderland/logstash-forwarder
TimeoutStartSec=0
ExecStart=/bin/bash -c '/usr/bin/docker start -a logstash-forwarder || /usr/bin/docker run --name logstash-forwarder -v /var/lib/docker:/var/lib/docker:ro -v /var/run/docker.sock:/var/run/docker.sock --link logstash:logstash --volumes-from logstash digitalwonderland/logstash-forwarder -quiet'
TimeoutStopSec=30
ExecStop=/usr/bin/docker stop logstash-forwarder
[Install]
WantedBy=multi-user.target
[X-Fleet]
X-Conflicts=logstash-forwarder.service
- name: kibana.service
command: start
enable: true
content: |
[Unit]
Description=Kibana
Documentation=http://www.elasticsearch.org/overview/kibana/
After=docker.service
Requires=docker.service
After=elasticsearch.service
Requires=elasticsearch.service
[Service]
EnvironmentFile=/etc/environment
ExecStartPre=/usr/bin/docker pull digitalwonderland/kibana
TimeoutStartSec=0
ExecStart=/bin/bash -c '/usr/bin/docker start -a kibana || /usr/bin/docker run --name kibana -p 5601:5601 --link elasticsearch:elasticsearch digitalwonderland/kibana'
TimeoutStopSec=30
ExecStop=/usr/bin/docker stop kibana
[Install]
WantedBy=multi-user.target
write_files:
- path: /etc/profile.d/alias.sh
content: |
alias l='ls -la'
alias ll='ls -lah'
alias d='docker'
alias ds='docker ps'
alias dsa='docker ps -a'
alias di='docker images'
alias dl='docker logs'
alias dlf='docker logs -f'
alias drm='docker rm -f'
alias drmi='docker rmi'
alias sd='sudo systemctl'
alias cci='sudo coreos-cloudinit --from-file'
alias j='journalctl'
function nsa { sudo nsenter -p -u -m -i -n -t $(docker inspect -f '{{ .State.Pid }}' $1) ; }