Add some aws helper scripts

This commit is contained in:
Andrea Fazzi 2020-02-21 11:43:01 +01:00
parent d75ae55db5
commit ec0c8f740c
4 changed files with 71 additions and 0 deletions

14
Dockerfile.aws Normal file
View file

@ -0,0 +1,14 @@
FROM golang:latest
ENV PATH=$PATH:/src/oef/
RUN mkdir -p /src/oef
ADD . /src/oef
COPY config/config.aws.yaml /src/oef/config/config.yaml
WORKDIR /src/oef/
RUN go build -o oef *.go
ENTRYPOINT ["/src/oef/oef"]
EXPOSE 3000

18
bash/ecr-push.bash Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
## Login
aws ecr get-login-password | docker login --username AWS --password-stdin 185273882442.dkr.ecr.eu-central-1.amazonaws.com
## Build the image
docker build -f Dockerfile.aws -t oef .
## Tag the image
docker tag oef:latest 185273882442.dkr.ecr.eu-central-1.amazonaws.com/oef:latest
## Push the image
docker push 185273882442.dkr.ecr.eu-central-1.amazonaws.com/oef:latest

6
bash/rds-connect.bash Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
RDSHOST="oef-free-tier.cjsemjfwbreb.eu-central-1.rds.amazonaws.com"
TOKEN="$(aws rds generate-db-auth-token --hostname $RDSHOST --port 3306 --region eu-central-1 --username admin)"
echo $TOKEN
mysql --host=$RDSHOST --port=3306 --ssl-ca=/sample_dir/rds-combined-ca-bundle.pem --enable-cleartext-plugin --user=admin --password=$TOKEN

33
config/config.aws.yaml Normal file
View file

@ -0,0 +1,33 @@
url: "https://gara.olimpiadi-economiaefinanza.it"
domain: "olimpiadi-economiaefinanza.it"
log_level: 2
language: "it"
jwt_expire_time: 120
keys:
cookie_store_key: "2a=UvD!"
jwt_signing_key: "ytOC>3,"
orm:
connection: "admin:remaccio1607@tcp(oef-micro.cjsemjfwbreb.eu-central-1.rds.amazonaws.com:3306)/oef_prod"
options: "charset=utf8&parseTime=True&loc=Local"
automigrate: true
reset: false
regenerate: false
admin:
username: "admin"
password: "aolieVooju"
subscriber:
password: "subscribe"
smtp:
host: "smtps.aruba.it"
port: 465
username: "supporto.informatico@olimpiadi-economiaefinanza.it"
password: "^7Ra~}zN"
subject: "[OEF2020] - Credenziali di accesso della scuola"
from: "noreply@olimpiadi-economiaefinanza.it"
bcc: "posta@andreafazzi.eu"