Skip to content

Commit 130bcc8

Browse files
committed
Change default stack name for dokku, update to latest version of dokku, add root volume size prompt
1 parent 9420457 commit 130bcc8

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Run `./dokku` and follow the prompts to enter an application name, domain, email
4444

4545
After completing successfully, the script will store an SSH key in `~/.ssh` to be used to log in to the new instance.
4646

47-
`ssh -i ~/.ssh/dokku-[App name]-key-pair.pem admin@[Domain or/IP address of instance]`
47+
`ssh -i ~/.ssh/[App name]-dokku-key-pair.pem admin@[Domain or/IP address of instance]`
4848

4949
Configure the DNS records for your domain to point to the new IP address of the instance to use a domain name address.
5050

dokku

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ read -p "Host domain for the instance: " DOMAIN
55
read -p "Contact email to use for LetsEncrypt SSL registration: " LETSENCRYPT_EMAIL
66
read -p "Instance type [t3a.small]: " INSTANCE_TYPE
77
INSTANCE_TYPE=${INSTANCE_TYPE:=t3a.small}
8+
read -p "Instance root volume size in GB [12]: " VOLUME_SIZE
9+
VOLUME_SIZE=${VOLUME_SIZE:=12}
810

911
# determine architecture type from instance type
1012
if [[ "$INSTANCE_TYPE" =~ g\. ]]; then
@@ -16,17 +18,17 @@ fi
1618
# get the appropriate Debian 12 (Bookworm) AMI for the current region and architecture
1719
IMAGE_ID=`aws ssm get-parameters-by-path --path /aws/service/debian/release/bookworm/latest --output text | grep -m 1 -oP "${TARGET_ARCH}[[:blank:]]+String[[:blank:]]+\K(ami-[^[:blank:]]+)"`
1820

19-
aws cloudformation create-stack --capabilities CAPABILITY_NAMED_IAM --stack-name dokku-${APP_NAME} --template-body file://./dokku.json --parameters ParameterKey=ApplicationName,ParameterValue=$APP_NAME ParameterKey=LetsEncryptEmail,ParameterValue=$LETSENCRYPT_EMAIL ParameterKey=DokkuHostname,ParameterValue="$DOMAIN" ParameterKey=InstanceImageId,ParameterValue="$IMAGE_ID" ParameterKey=InstanceType,ParameterValue="$INSTANCE_TYPE"
21+
aws cloudformation create-stack --capabilities CAPABILITY_NAMED_IAM --stack-name ${APP_NAME}-dokku --template-body file://./dokku.json --parameters ParameterKey=ApplicationName,ParameterValue=$APP_NAME ParameterKey=LetsEncryptEmail,ParameterValue=$LETSENCRYPT_EMAIL ParameterKey=DokkuHostname,ParameterValue="$DOMAIN" ParameterKey=InstanceImageId,ParameterValue="$IMAGE_ID" ParameterKey=InstanceType,ParameterValue="$INSTANCE_TYPE" ParameterKey=InstanceRootVolumeSize,ParameterValue="$VOLUME_SIZE"
2022

2123
# wait for key pair to become available
2224
while : ; do
23-
KEY_NAME=`aws ec2 describe-key-pairs --filters Name=key-name,Values=dokku-${APP_NAME}-key-pair --query KeyPairs[*].KeyPairId --output text`
25+
KEY_NAME=`aws ec2 describe-key-pairs --filters Name=key-name,Values=${APP_NAME}-dokku-key-pair --query KeyPairs[*].KeyPairId --output text`
2426
if [ "$KEY_NAME" != "" ]; then
2527
break
2628
fi
2729
sleep 1
2830
done
2931

3032
# download into a pem file in ~/.ssh
31-
aws ssm get-parameter --name /ec2/keypair/${KEY_NAME} --with-decryption --query Parameter.Value --output text > ~/.ssh/dokku-${APP_NAME}-key-pair.pem
32-
chmod 600 ~/.ssh/dokku-${APP_NAME}-key-pair.pem
33+
aws ssm get-parameter --name /ec2/keypair/${KEY_NAME} --with-decryption --query Parameter.Value --output text > ~/.ssh/${APP_NAME}-dokku-key-pair.pem
34+
chmod 600 ~/.ssh/${APP_NAME}-dokku-key-pair.pem

dokku.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"Type": "String"
3232
},
3333
"DokkuVersion": {
34-
"Default": "v0.34.8",
35-
"Description": "Dokku version to install, e.g., \"v0.34.8\" (see https://github.com/dokku/dokku/releases).",
34+
"Default": "v0.35.14",
35+
"Description": "Dokku version to install, e.g., \"v0.35.14\" (see https://github.com/dokku/dokku/releases).",
3636
"Type": "String"
3737
},
3838
"InstanceImageId": {
@@ -140,7 +140,7 @@
140140
"Properties": {
141141
"GroupDescription": "Allow http/https/ssh traffic",
142142
"GroupName": {
143-
"Fn::Sub": "dokku-${ApplicationName}-ec2-sg"
143+
"Fn::Sub": "${ApplicationName}-dokku-ec2-sg"
144144
},
145145
"SecurityGroupIngress": [
146146
{
@@ -168,7 +168,7 @@
168168
"KeyPair": {
169169
"Properties": {
170170
"KeyName": {
171-
"Fn::Sub": "dokku-${ApplicationName}-key-pair"
171+
"Fn::Sub": "${ApplicationName}-dokku-key-pair"
172172
}
173173
},
174174
"Type": "AWS::EC2::KeyPair"

0 commit comments

Comments
 (0)