Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: cleaning #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ commitHash
.vscode
.DS_Store
package-lock.json
.theia
.theia
docker-compose.prod.yml
Makefile.prod
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dogecoin Testnet Faucet

Code for the Dogecoin Testnet Faucet at http://shibe.technology
6 changes: 2 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
FROM golang AS build
RUN ["mkdir", "-p", "/out/data", "/out/lib/x86_64-linux-gnu", "/out/lib64"]
RUN cp /lib/x86_64-linux-gnu/libdl.so* /lib/x86_64-linux-gnu/libdl-*.so /lib/x86_64-linux-gnu/libpthread.so* /lib/x86_64-linux-gnu/libpthread-*.so /lib/x86_64-linux-gnu/libc.so* /lib/x86_64-linux-gnu/libc-*.so /lib/x86_64-linux-gnu/ld-*.so /out/lib/x86_64-linux-gnu
RUN cp /lib64/ld-linux-x86-64.so* /out/lib64

WORKDIR /backend
COPY go.mod go.sum ./
RUN ["go", "build", "github.com/mattn/go-sqlite3", "gopkg.in/yaml.v3"]
COPY . .
COPY faucetd.yaml /out/
RUN ["go", "build", "-o", "/out/faucetd", "faucet/cmd/faucetd"]

FROM scratch
FROM debian
COPY --from=build /out /
WORKDIR /data
RUN ["/faucetd", "db", "create", "/faucetd.yaml"]
Expand Down
95 changes: 40 additions & 55 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,58 @@
version: '3.7'

services:
traefik:
image: "traefik:latest"
container_name: traefik
command:
#- "--api.dashboard=true"
- '--api.dashboard=false'
#- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.tlsbroker.acme.tlschallenge=true"
- "--certificatesresolvers.tlsbroker.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.tlsbroker.acme.email=contact@shibe.technology"
- "--certificatesresolvers.tlsbroker.acme.storage=/letsencrypt/acme.json"
- '--providers.docker=true'
- '--providers.docker.exposedByDefault=false'
- '--entrypoints.http=true'
- '--entrypoints.http.address=:80'
- '--entrypoints.http.http.redirections.entrypoint.to=https'
- '--entrypoints.http.http.redirections.entrypoint.scheme=https'
- '--entrypoints.https=true'
- '--entrypoints.https.address=:443'
- '--certificatesresolvers.tlsbroker.acme.tlschallenge=true'
- '--certificatesresolvers.tlsbroker.acme.email=contact@shibe.technology'
- '--certificatesresolvers.tlsbroker.acme.storage=/letsencrypt/acme.json'
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
- ./letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "80:80"
- "443:443"
- "127.0.0.1:8080:8080"
restart: always
labels:
- "traefik.enable=true"
# HTTPS Redirect
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https@docker"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- 80:80
- 443:443

frontend:
build: ./frontend
command: ["npm", "run", "build"]
volumes:
- "frontend:/usr/src/app"

nginx:
restart: always
build: ./nginx
depends_on:
- frontend
volumes:
- "data:/usr/src/app"
build: ./frontend
labels:
- "traefik.enable=true"
- 'traefik.enable=true'
# routers
- "traefik.http.routers.nginx.rule=Host(`shibe.technology`)"
- "traefik.http.routers.nginx.entrypoints=websecure"
- "traefik.http.routers.nginx.tls.certresolver=tlsbroker"
- "traefik.http.routers.nginx.tls=true"
- 'traefik.http.routers.nginx.rule=Host(`shibe.technology`)'
- 'traefik.http.routers.nginx.entrypoints=https'
- 'traefik.http.routers.nginx.tls.certresolver=tlsbroker'
- 'traefik.http.routers.nginx.tls=true'
# services
- "traefik.http.services.nginx.loadbalancer.server.port=80"

- 'traefik.http.services.nginx.loadbalancer.server.port=80'
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro

backend:
build: ./backend
restart: always
labels:
- "traefik.enable=true"
- 'traefik.enable=true'
# routers
- "traefik.http.routers.backend.rule=Host(`api.shibe.technology`)"
- "traefik.http.routers.backend.entrypoints=websecure"
- "traefik.http.routers.backend.tls.certresolver=tlsbroker"
- "traefik.http.routers.backend.tls=true"
- 'traefik.http.routers.backend.rule=Host(`api.shibe.technology`)'
- 'traefik.http.routers.backend.entrypoints=https'
- 'traefik.http.routers.backend.tls.certresolver=tlsbroker'
- 'traefik.http.routers.backend.tls=true'
#services
- "traefik.http.services.backend.loadbalancer.server.port=5000"
- 'traefik.http.services.backend.loadbalancer.server.port=5000'
volumes:
- "data:/data"
- ./data:/data

fathom:
image: usefathom/fathom:latest
Expand All @@ -82,16 +67,16 @@ services:
- "FATHOM_DATABASE_PASSWORD=password"
- "FATHOM_SECRET=secret"
labels:
- "traefik.enable=true"
- 'traefik.enable=true'
# routers
- "traefik.http.routers.fathom.rule=Host(`fathom.shibe.technology`)"
- "traefik.http.routers.fathom.entrypoints=websecure"
- "traefik.http.routers.fathom.tls.certresolver=tlsbroker"
- "traefik.http.routers.fathom.tls=true"
- 'traefik.http.routers.fathom.rule=Host(`fathom.shibe.technology`)'
- 'traefik.http.routers.fathom.entrypoints=https'
- 'traefik.http.routers.fathom.tls.certresolver=tlsbroker'
- 'traefik.http.routers.fathom.tls=true'
# services
- "traefik.http.services.fathom.loadbalancer.server.port=8080"
- 'traefik.http.services.fathom.loadbalancer.server.port=8080'
volumes:
- "fathom:/app/data"
- ./fathom:/app/data

volumes:
frontend:
Expand Down
16 changes: 7 additions & 9 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
FROM node:latest

# File Author / Maintainer
MAINTAINER Lola Rigaut-Luczak <[email protected]>
FROM node:latest AS builder

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# For npm@5 or later, copy package-lock.json as well
COPY package.json package-lock.json ./
# Bundle app source
# Copy source files
COPY . .

RUN npm install
RUN cp -r src dist
RUN npm run browserify:dist

FROM nginx:1.27

# Issue. Make build won't work because we don't have the .git or git command.
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html/
8 changes: 1 addition & 7 deletions frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,5 @@ build:
@echo "Cloning src"
cp -r src dist

@echo "Adding commit hash"
python3 commitHashInjector/main.py

@echo "Building JS file"
npm run browserify:dist

@echo "Removing old files"
rm dist/indexVanilla.html && rm dist/mainUnbundled.js
npm run browserify:dist
Loading