pull/10/head
Hunter Long 2018-06-24 15:53:48 -07:00
parent 087403a0d9
commit aeed39bc3e
11 changed files with 69 additions and 28 deletions

View File

@ -40,7 +40,7 @@ deploy:
- "build/statup-linux-arm64"
- "build/statup-linux-arm7"
- "build/statup-windows-x64.exe"
- "build/statup-alpine"
- "build/statup-linux-alpine"
skip_cleanup: true
notifications:

View File

@ -3,7 +3,7 @@ FROM alpine:latest
ENV VERSION=v0.22
RUN apk --no-cache add ca-certificates
RUN wget https://github.com/hunterlong/statup/releases/download/$VERSION/statup-alpine && \
RUN wget https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-alpine && \
chmod +x statup-alpine && \
mv statup-alpine /usr/local/bin/statup
WORKDIR /app

View File

@ -38,19 +38,25 @@ LETSENCRYPT_HOST=mydomain.com \
Once your instance has started, it will take a moment to get your SSL certificate. Make sure you have a A or CNAME record on your domain that points to the IP/DNS of your server running Statup.
## Run on AWS EC2
Running Statup on the smallest EC2 server is very quick using the AWS AMI Image: `ami-1f7c3567`.
Running Statup on the smallest EC2 server is very quick using the AWS AMI Image: `ami-84da93fc`.
```bash
aws ec2 run-instances \
--image-id ami-1f7c3567 \
--count 1 \
--instance type t2.micro \
--region us-west-2
--key-name <key name> \
--security-group-ids <your security group id here> \
--subnet-id <your subnet id here> \
--region <your region here>
ec2-run-instances --key KEYPAIR ami-84da93fc
```
# EC2 with SSL Certificate
```bash
wget https://raw.githubusercontent.com/hunterlong/statup/master/servers/ec2-ssl.sh
#
# Edit ec2-ssl.sh and add LETSENCRYPT_HOST and LETSENCRYPT_EMAIL
#
# nano ec2-ssl.sh
#
ec2-run-instances --key KEYPAIR \
--user-data-file ec2-ssl.sh \
ami-bf5eb9d6
```
## Email Nofitications
Statup includes email notification via SMTP if your services go offline.

View File

@ -14,7 +14,7 @@ xgo -go 1.10.x --targets=windows-6.0/amd64 --dest=build -ldflags="-X main.VERSIO
xgo -go 1.10.x --targets=linux/arm-7 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=linux/arm64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
CGO_ENABLED=0 GOOS=linux go build -ldflags="-X main.VERSION=$VERSION" -a -o build/statup-alpine .
CGO_ENABLED=0 GOOS=linux go build -ldflags="-X main.VERSION=$VERSION" -a -o build/statup-linux-alpine .
cd build
ls

View File

@ -46,8 +46,8 @@ func (u *Service) DeleteFailures() {
func (s *Service) LimitedFailures() []*Failure {
var fails []*Failure
col := dbSession.Collection("failures").Find("service", s.Id)
col.OrderBy("create_at").All(&fails)
col := dbSession.Collection("failures").Find("service", s.Id).OrderBy("-id").Limit(10)
col.All(&fails)
return fails
}

View File

@ -44,9 +44,9 @@
{{ range .Services }}
{{ if .Failures }}
{{ if .LimitedFailures }}
<div class="list-group mt-5">
{{ range .Failures }}
{{ range .LimitedFailures }}
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{.ParseError}}</h5>

View File

@ -8,6 +8,8 @@ services:
ports:
- 0.0.0.0:80:80
- 0.0.0.0:443:443
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
networks:
- internet
restart: always
@ -18,7 +20,20 @@ services:
- ./statup/nginx/html:/usr/share/nginx/html:ro
- ./statup/nginx/dhparam:/etc/nginx/dhparam
environment:
DEFAULT_HOST: localhost
DEFAULT_HOST: ${LETSENCRYPT_HOST}
letsencrypt:
container_name: letsencrypt
image: jrcs/letsencrypt-nginx-proxy-companion
networks:
- internet
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./statup/nginx/certs:/etc/nginx/certs
- ./statup/nginx/vhost:/etc/nginx/vhost.d
- ./statup/nginx/html:/usr/share/nginx/html
- ./statup/nginx/dhparam:/etc/nginx/dhparam
statup:
container_name: statup
@ -32,15 +47,17 @@ services:
volumes:
- ./statup/app:/app
environment:
VIRTUAL_HOST: localhost
VIRTUAL_HOST: ${LETSENCRYPT_HOST}
VIRTUAL_PORT: 8080
LETSENCRYPT_HOST: ${LETSENCRYPT_HOST}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
DB_CONN: postgres
DB_HOST: postgres
DB_USER: statup
DB_PASS: password123
DB_DATABASE: statup
NAME: EC2 Example
DESCRIPTION: This is a Statup Docker Compose instance
NAME: Statup on EC2
DESCRIPTION: This Status Status Page should be running ${LETSENCRYPT_HOST} with SSL.
postgres:
container_name: postgres

20
servers/ec2-ssl.sh Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
## Domain for new SSL certificate
LETSENCRYPT_HOST="status.balancebadge.io"
## An email address that can recover SSL certificate from Lets Encrypt
LETSENCRYPT_EMAIL="info@socialeck.com"
###################################################
############# Leave this part alone ###############
###################################################
printf "Statup will try to create an SSL for domain: $LETSENCRYPT_HOST\n"
printf "\nexport LETSENCRYPT_HOST=$LETSENCRYPT_HOST\n" >> /home/ubuntu/.profile
printf "export LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL\n" >> /home/ubuntu/.profile
sudo printf "\nexport LETSENCRYPT_HOST=$LETSENCRYPT_HOST\n" >> /root/.profile
sudo printf "export LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL\n" >> /root/.profile
source /home/ubuntu/.profile
sudo /bin/bash -c "source /root/.profile"
LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL ./startup.sh

View File

@ -2,4 +2,4 @@
cd /home/ubuntu
curl -o /home/ubuntu/startup.sh -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/startup.sh
chmod +x /home/ubuntu/startup.sh
./startup.sh
LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL ./startup.sh

View File

@ -1,9 +1,7 @@
#!/usr/bin/env bash
LETSENCRYPT_HOST="status.balancebadge.io"
LETSENCRYPT_EMAIL="info@socialeck.com"
cd /home/ubuntu
rm -f docker-compose.yml
curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statu$
curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose-ssl.yml
sudo service docker start
sudo docker system prune -af
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose pull

View File

@ -4,5 +4,5 @@ rm -f docker-compose.yml
curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose.yml
sudo service docker start
sudo docker system prune -af
sudo docker-compose pull
sudo docker-compose up -d
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose pull
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose up -d