Skip to content

Commit

Permalink
move to new infra
Browse files Browse the repository at this point in the history
  • Loading branch information
foodelevator committed Nov 22, 2024
1 parent 73750c3 commit 0336b0c
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 14 deletions.
1 change: 0 additions & 1 deletion .buildpacks

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy

on:
push:
branches: [ master ]
workflow_dispatch:

env:
NOMAD_VERSION: 1.7.7

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Set environment variables
run: |
cat >> "$GITHUB_ENV" <<EOF
latest=ghcr.io/${{ github.repository }}:latest
current=ghcr.io/${{ github.repository }}:$(git rev-parse --short ${{ github.sha }})
EOF
- name: Download Nomad
run: |
curl -LO https://releases.hashicorp.com/nomad/${{ env.NOMAD_VERSION }}/nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip
unzip -d /usr/local/bin nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip nomad
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.latest }},${{ env.current }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Deploy to nomad
env:
NOMAD_ADDR: ${{ vars.NOMAD_ADDR }}
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
run: |
nomad run -var=image_tag=${{ env.current }} job.nomad.hcl
Empty file removed .static
Empty file.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM busybox:1-musl
WORKDIR /app

RUN echo "E404:/app/index.html" > /httpd.conf
COPY public /app

EXPOSE 3000
CMD ["httpd", "-fp3000", "-c/httpd.conf"]
40 changes: 40 additions & 0 deletions job.nomad.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
job "wookieleaks" {
type = "service"

group "wookieleaks" {
network {
port "http" {
to = 3000
}
}

service {
name = "wookieleaks"
port = "http"
provider = "nomad"
tags = [
"traefik.enable=true",
"traefik.http.routers.wookieleaks.rule=Host(`wookieleaks.org`)||Host(`www.wookieleaks.org`)",
"traefik.http.routers.wookieleaks.tls.certresolver=default",
]
}

task "wookieleaks" {
driver = "docker"

config {
image = var.image_tag
ports = ["http"]
}

resources {
memory = 50
}
}
}
}

variable "image_tag" {
type = string
default = "ghcr.io/datasektionen/wookieleaks:latest"
}
File renamed without changes
26 changes: 13 additions & 13 deletions index.html → public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="top-navigation">
<nav class="navbar">
<div class="nav-logo">
<a href="https://wookieleaks.org/">
<a href="/">
<h1>
<font color=#946d44>W</font>oo<font color=#d89a5d>ki</font><font color=#946d44>e</font>leaks
</h1>
Expand All @@ -29,25 +29,25 @@ <h1>
</div>
<nav id="menu" class="side-nav rub">
<div class="menu-wrapper">
<a class="close-btn nav-element" href="https://Wookieleaks.org/#"></a>
<a class="close-btn nav-element" href="/#"></a>
</div>
</nav>
<div class="content">
<div class="home-container"></div>

<ul class="tag-navigation">
<li><a href="https://wookieleaks.org/">Läckta imperieuppgifter</a></li>
<li><a href="https://wookieleaks.org/">Intergalaktisk politik</a></li>
<li><a href="https://wookieleaks.org/">Militära angelägenheter</a></li>
<li><a href="https://wookieleaks.org/">Jedi-hemlisar</a></li>
<li><a href="/">Läckta imperieuppgifter</a></li>
<li><a href="/">Intergalaktisk politik</a></li>
<li><a href="/">Militära angelägenheter</a></li>
<li><a href="/">Jedi-hemlisar</a></li>
</ul>

<h2>Läckor</h2>

<ul class="grid">
<li class="tile rub34 double-sized with-image">
<a href="https://wookieleaks.org/ritningar/">
<div class="teaser"><img class="spip_logos" alt="" src="./dodsstjarnan_ritningar.png" width="360"
<a href="/">
<div class="teaser"><img class="spip_logos" alt="" src="/dodsstjarnan_ritningar.png" width="360"
height="240"></div>
<div class="text">
<h2 class="title">Dödsstjärnans ritningar</h2>
Expand All @@ -61,8 +61,8 @@ <h2 class="title">Dödsstjärnans ritningar</h2>
</li>

<li class="tile rub34 featured with-image">
<a href="https://Wookieleaks.org/">
<div class="teaser"><img class="spip_logos" alt="" src="./wookieleaks.png" width="360" height="240"></div>
<a href="/">
<div class="teaser"><img class="spip_logos" alt="" src="/wookieleaks.png" width="360" height="240"></div>
<div class="text">
<h2 class="title">Kryddsmugglaren</h2>
<div class="intro">
Expand All @@ -75,8 +75,8 @@ <h2 class="title">Kryddsmugglaren</h2>
</li>

<li class="tile rub33 featured with-image">
<a href="https://Wookieleaks.org/">
<div class="teaser"><img class="spip_logos" alt="" src="./wookieleaks.png" width="360" height="240"></div>
<a href="/">
<div class="teaser"><img class="spip_logos" alt="" src="/wookieleaks.png" width="360" height="240"></div>
<div class="text">
<h2 class="title">Svensexan</h2>
<div class="intro">
Expand All @@ -99,4 +99,4 @@ <h2 class="title">Svensexan</h2>
e.innerHTML = e.innerHTML.replace("YYYY", year);
})
</script>
</html>
</html>
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes

0 comments on commit 0336b0c

Please sign in to comment.