Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

infra: Digital Ocean based infrastructure #1244

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Delpoy

on: [push, pull_request]

jobs:
do:
name: Digital Ocean
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
env:
PYTHON_VERSION: 3.7

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: $PYTHON_VERSION
- name: Get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: pip cache
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
python -m pip install -r requirements.txt
- name: Run deployment script
run: |
export DIGITALOCEAN_ACCESS_TOKEN=${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
export DO_SSH_KEY_NAME=${{ secrets.DO_SSH_KEY_NAME }}
export DO_SSH_KEY_PASSWORD=${{ secrets.DO_SSH_KEY_PASSWORD }}
export DO_SSH_KEY_PRIVATE=${{ secrets.DO_SSH_KEY_PRIVATE }}
export DO_SSH_KEY_PUBLIC=${{ secrets.DO_SSH_KEY_PUBLIC }}
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
python infra/do.py
298 changes: 0 additions & 298 deletions .github/workflows/testing.yml

This file was deleted.

2 changes: 2 additions & 0 deletions infra/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!caddy
2 changes: 2 additions & 0 deletions infra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
caddy
cert/
30 changes: 30 additions & 0 deletions infra/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
chadig.com:8080 {
tls off
redir 301 {
/ https://{host}{uri}
}
}

chadig.com:4443 {
root /sites/chadig/blog
index index.md
ext .md
markdown {
template default templates/default.html
}
}

dffml-webhook.chadig.com:4443 {
status 200 /
}

dataflow.ml:8080 {
tls off
redir 301 {
/ https://{host}{uri}
}
}

dataflow.ml:4443 {
redir https://intel.github.io/dffml
}
8 changes: 8 additions & 0 deletions infra/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM alpine
# Certs are needed to talk to Let's Encrypt ACME resolver
RUN apk --no-cache add ca-certificates curl tar grep sed && \
latest=$(curl -sSL https://github.com/caddyserver/caddy/releases | grep _linux_amd64.tar.gz | head -n 1 | sed -e 's/.*download\///g' -e 's/".*//g') && \
curl -L "https://github.com//caddyserver/caddy/releases/download/${latest}" | tar -xvz -C /usr/bin && \
apk --no-cache del curl tar grep sed
ENV CADDYPATH /.cert
CMD ["/usr/bin/caddy", "-conf", "/Caddyfile", "-agree", "-email", "johnandersenpdx@gmail.com"]
Loading