Skip to content

Commit

Permalink
EB fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed May 10, 2020
1 parent 9ac201c commit ce5e430
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 41 deletions.
5 changes: 0 additions & 5 deletions .ebextensions/21-logs.config

This file was deleted.

62 changes: 31 additions & 31 deletions .ebextensions/30-certbot.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@

# Once you have the cert and the symlink is set up, update nginx.conf to use it.

files:
/opt/certbot-renew:
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash -e
# Sleep randomly, up to 10 minutes, to make it less likely that two servers try to renew at the same time
sleep $(($RANDOM%600))
/opt/certbot-auto renew --debug
# Reload the nginx configuration every time, since there may be multiple servers running. Using --renew-hook would only fix the server that made the renewal.
service nginx reload

/etc/cron.d/certbot:
mode: "000644"
owner: root
group: root
content: |
@daily root /opt/certbot-renew

container_commands:
"01":
command: |
wget -O certbot-auto https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto --debug --install-only --non-interactive
cwd: /opt
test: test ! -f /opt/certbot-auto
"02":
command: mkdir -p /var/acme-challenges
test: test ! -d /var/acme-challenges
# files:
# /opt/certbot-renew:
# mode: "000755"
# owner: root
# group: root
# content: |
# #!/bin/bash -e
# # Sleep randomly, up to 10 minutes, to make it less likely that two servers try to renew at the same time
# sleep $(($RANDOM%600))
# /opt/certbot-auto renew --debug
# # Reload the nginx configuration every time, since there may be multiple servers running. Using --renew-hook would only fix the server that made the renewal.
# service nginx reload
#
# /etc/cron.d/certbot:
# mode: "000644"
# owner: root
# group: root
# content: |
# @daily root /opt/certbot-renew
#
# container_commands:
# "01":
# command: |
# wget -O certbot-auto https://dl.eff.org/certbot-auto
# chmod a+x certbot-auto
# ./certbot-auto --debug --install-only --non-interactive
# cwd: /opt
# test: test ! -f /opt/certbot-auto
# "02":
# command: mkdir -p /var/acme-challenges
# test: test ! -d /var/acme-challenges
6 changes: 3 additions & 3 deletions .ebextensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ First of all, make sure you are running the latest version of the eb cli:
pip3 install -U --user awscli awsebcli
```

If you are using the free tier, then use a t2.micro instance. If not, you can use a t3.nano or t3a.nano with spot to get the lowest price.
Use a t2.micro instance if you are using the AWS free tier. Otherwise, use t3.nano or t3a.nano with spot to get the lowest price.

Create environment:
```
git tag -a -m "First deploy" eb-v1
git tag -f -a -m "First deploy" eb
eb init rssbox --platform "Ruby 2.6 (Puma)" --keyname id_rsa
eb create --single --instance-types t2.micro
eb create --single --instance_type t2.micro
```

Using spot instances:
Expand Down
2 changes: 1 addition & 1 deletion .ebextensions/resources.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# aws cloudformation get-template --stack-name "awseb-${env_id}-stack" --query TemplateBody > template.json

# Get parameters:
# aws cloudformation describe-stack-resource --stack-name awseb-e-rm3jns32ap-stack --logical-resource-id AWSEBBeanstalkMetadata --query StackResourceDetail.Metadata --output text | jq
# aws cloudformation describe-stack-resource --stack-name "awseb-${env_id}-stack" --logical-resource-id AWSEBBeanstalkMetadata --query StackResourceDetail.Metadata --output text | jq

Resources:
AWSEBAutoScalingGroup:
Expand Down
2 changes: 1 addition & 1 deletion bin/eb-deploy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e
# eb has issues deploying if the latest tag has a slash in it.. annoying since my heroku deploy tags have slashes, e.g. heroku/v123
# eb has issues deploying if the most recent tag has a slash in it.. annoying since my heroku deploy tags have slashes, e.g. heroku/v123
label=$(date -u '+%FT%TZ')

set -x
Expand Down

0 comments on commit ce5e430

Please sign in to comment.