-
Notifications
You must be signed in to change notification settings - Fork 0
/
dokku.json
177 lines (177 loc) · 4.58 KB
/
dokku.json
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "EC2 instance with Dokku, Postgres, and LetsEncrypt installed",
"Outputs": {
"PublicDnsName": {
"Description": "Public DNS name of the instance",
"Value": {
"Fn::GetAtt": [
"Instance",
"PublicDnsName"
]
}
},
"PublicIP": {
"Description": "Public IP address of the instance",
"Value": {
"Fn::GetAtt": [
"Instance",
"PublicIp"
]
}
}
},
"Parameters": {
"ApplicationName": {
"Description": "Name of the first application to set up on this Dokku instance",
"Type": "String"
},
"DokkuHostname": {
"Description": "The domain name for accessing this application",
"Type": "String"
},
"DokkuVersion": {
"Default": "v0.34.8",
"Description": "Dokku version to install, e.g., \"v0.34.8\" (see https://github.com/dokku/dokku/releases).",
"Type": "String"
},
"InstanceImageId": {
"Description": "The AMI ID for the application server instance",
"Type": "String"
},
"InstanceRootVolumeSize": {
"Default": "12",
"Description": "The size of the root volume (in GB).",
"Type": "Number"
},
"InstanceType": {
"AllowedValues": [
"t2.small",
"t3.small",
"t3a.small",
"t4g.small",
"t4g.medium",
"t4g.large"
],
"Default": "t3a.small",
"Description": "The application server instance type",
"Type": "String"
},
"LetsEncryptEmail": {
"Description": "Email address to use with LetsEncrypt, to receive notifications of SSL cert renewals, etc",
"Type": "String"
}
},
"Resources": {
"Instance": {
"Properties": {
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"VolumeSize": {
"Ref": "InstanceRootVolumeSize"
}
}
}
],
"ImageId": {
"Ref": "InstanceImageId"
},
"InstanceType": {
"Ref": "InstanceType"
},
"KeyName": {
"Ref": "KeyPair"
},
"SecurityGroups": [
{
"Ref": "InstanceSecurityGroup"
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "AWS::StackName"
}
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash\n",
"sudo apt-get update -y\n",
"sudo apt-get install -y cron\n",
"wget -NP . https://dokku.com/install/",
{
"Ref": "DokkuVersion"
},
"/bootstrap.sh\n",
"sudo DOKKU_TAG=",
{
"Ref": "DokkuVersion"
},
" bash bootstrap.sh\n",
"dokku domains:set-global ",
{
"Ref": "DokkuHostname"
},
"\n",
"dokku builder:set --global selected herokuish\n",
"sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git\n",
"sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git\n",
"dokku letsencrypt:set --global email ",
{
"Ref": "LetsEncryptEmail"
},
"\n",
"dokku letsencrypt:cron-job --add\n"
]
]
}
}
},
"Type": "AWS::EC2::Instance"
},
"InstanceSecurityGroup": {
"Properties": {
"GroupDescription": "Allow http/https/ssh traffic",
"GroupName": {
"Fn::Sub": "dokku-${ApplicationName}-ec2-sg"
},
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
"FromPort": 80,
"IpProtocol": "tcp",
"ToPort": 80
},
{
"CidrIp": "0.0.0.0/0",
"FromPort": 443,
"IpProtocol": "tcp",
"ToPort": 443
},
{
"CidrIp": "0.0.0.0/0",
"FromPort": 22,
"IpProtocol": "tcp",
"ToPort": 22
}
]
},
"Type": "AWS::EC2::SecurityGroup"
},
"KeyPair": {
"Properties": {
"KeyName": {
"Fn::Sub": "dokku-${ApplicationName}-key-pair"
}
},
"Type": "AWS::EC2::KeyPair"
}
}
}