Skip to content

Commit

Permalink
add compose
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Apr 10, 2022
1 parent a26c3bc commit 8840c6b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ docker:
COPY +build/tokei_rs tokei_rs
ENTRYPOINT ["./tokei_rs"]
SAVE IMAGE --push ghcr.io/xampprocky/tokei_rs

compose:
FROM earthly/dind:alpine
WORKDIR /test
COPY compose.yml ./
WITH DOCKER \
--compose compose.yml \
--load ghcr.io/xampprocky/tokei_rs:latest=(+docker)
RUN docker compose down && docker compose up --remove-orphans
END
27 changes: 27 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "3.7"

networks:
web:
external: true
internal:
external: false
driver: bridge

services:
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
- web
- internal

badge:
image: ghcr.io/xampprocky/tokei_rs
environment:
- RUST_LOG=debug
networks:
- internal
24 changes: 24 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
events { worker_connections 1024; }

http {

upstream app_servers { # Create an upstream for the web servers
server badge:8000; # the first server
}

server {
listen 80;

location / {
proxy_pass http://app_servers; # load balance the traffic
}
}

server {
listen 443;

location / {
proxy_pass http://app_servers; # load balance the traffic
}
}
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ async fn create_badge(
.ok_or_else(|| actix_web::error::ErrorBadRequest(eyre::eyre!("Invalid SHA provided.")))?;

if let Ok(if_none_match) = IfNoneMatch::parse(&request) {
log::debug!("Checking If-None-Match: {}", sha);
let sha_tag = EntityTag::new(false, sha.clone());
let found_match = match if_none_match {
IfNoneMatch::Any => false,
Expand Down

0 comments on commit 8840c6b

Please sign in to comment.