Skip to content

Commit

Permalink
Merge pull request #147 from picosh/am/light-refactor
Browse files Browse the repository at this point in the history
Refactor pubsub->pipe
  • Loading branch information
antoniomika authored Oct 11, 2024
2 parents 3d03d7b + 760d3c6 commit c9b9480
Show file tree
Hide file tree
Showing 45 changed files with 285 additions and 397 deletions.
32 changes: 16 additions & 16 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ AUTH_DOMAIN=http://auth.dev.pico.sh:3006
AUTH_ISSUER=pico.sh
AUTH_WEB_PORT=3000

PUBSUB_CADDYFILE=./caddy/Caddyfile
PUBSUB_V4=
PUBSUB_V6=
PUBSUB_HTTP_V4=$PUBSUB_V4:80
PUBSUB_HTTP_V6=[$PUBSUB_V6]:80
PUBSUB_HTTPS_V4=$PUBSUB_V4:443
PUBSUB_HTTPS_V6=[$PUBSUB_V6]:443
PUBSUB_SSH_V4=$PUBSUB_V4:22
PUBSUB_SSH_V6=[$PUBSUB_V6]:22
PUBSUB_HOST=
PUBSUB_SSH_PORT=2222
PUBSUB_WEB_PORT=3000
PUBSUB_PROM_PORT=9222
PUBSUB_DOMAIN=pubsub.dev.pico.sh:3001
PUBSUB_PROTOCOL=http
PUBSUB_DEBUG=1
PIPE_CADDYFILE=./caddy/Caddyfile
PIPE_V4=
PIPE_V6=
PIPE_HTTP_V4=$PIPE_V4:80
PIPE_HTTP_V6=[$PIPE_V6]:80
PIPE_HTTPS_V4=$PIPE_V4:443
PIPE_HTTPS_V6=[$PIPE_V6]:443
PIPE_SSH_V4=$PIPE_V4:22
PIPE_SSH_V6=[$PIPE_V6]:22
PIPE_HOST=
PIPE_SSH_PORT=2222
PIPE_WEB_PORT=3000
PIPE_PROM_PORT=9222
PIPE_DOMAIN=pipe.dev.pico.sh:3001
PIPE_PROTOCOL=http
PIPE_DEBUG=1
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
needs: test
strategy:
matrix:
APP: [prose, pastes, imgs, pgs, feeds, pubsub]
APP: [prose, pastes, imgs, pgs, feeds, pipe]
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bp-%: bp-setup
$(DOCKER_BUILDX_BUILD) --build-arg "APP=$*" -t "ghcr.io/picosh/pico/$*-web:$(DOCKER_TAG)" --target release-web .
.PHONY: bp-%

bp-all: bp-prose bp-pastes bp-imgs bp-feeds bp-pgs bp-auth bp-bouncer bp-pubsub
bp-all: bp-prose bp-pastes bp-imgs bp-feeds bp-pgs bp-auth bp-bouncer bp-pipe
.PHONY: bp-all

build-auth:
Expand All @@ -74,7 +74,7 @@ build-%:
go build -o "build/$*-ssh" "./cmd/$*/ssh"
.PHONY: build-%

build: build-prose build-pastes build-imgs build-feeds build-pgs build-auth build-pico build-pubsub
build: build-prose build-pastes build-imgs build-feeds build-pgs build-auth build-pico build-pipe
.PHONY: build

store-clean:
Expand Down
13 changes: 0 additions & 13 deletions caddy/Caddyfile.auth
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
on_demand_tls {
ask http://web:3000/check
interval 1m
burst 10
}
servers {
metrics
}
Expand Down Expand Up @@ -129,11 +124,3 @@
Access-Control-Allow-Headers "*"
}
}

:443 {
reverse_proxy web:3000
tls {$APP_EMAIL} {
on_demand
}
encode zstd gzip
}
102 changes: 0 additions & 102 deletions caddy/Caddyfile.monitoring

This file was deleted.

2 changes: 1 addition & 1 deletion caddy/Caddyfile.pico
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{$APP_DOMAIN}, tmp.pico.sh {
{$APP_DOMAIN} {
reverse_proxy https://pico-docs-prod.pgs.sh {
header_up Host pico-docs-prod.pgs.sh
}
Expand Down
54 changes: 54 additions & 0 deletions caddy/Caddyfile.pipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
servers {
metrics
}
}

*.{$APP_DOMAIN}, {$APP_DOMAIN} {
reverse_proxy web:3000
tls {$APP_EMAIL} {
dns cloudflare {$CF_API_TOKEN}
resolvers 1.1.1.1
}
encode zstd gzip

header {
# disable FLoC tracking
Permissions-Policy interest-cohort=()

# enable HSTS
Strict-Transport-Security max-age=31536000;

# disable clients from sniffing the media type
X-Content-Type-Options nosniff

# clickjacking protection
X-Frame-Options DENY

# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade

Content-Security-Policy "default-src 'self'; img-src * 'unsafe-inline'; style-src * 'unsafe-inline'"

X-XSS-Protection "1; mode=block"
}

@caddymetrics {
host {$APP_DOMAIN}
path /_caddy/metrics
}

metrics @caddymetrics {
disable_openmetrics
}

@appmetrics {
host {$APP_DOMAIN}
path /_app/metrics
}

handle @appmetrics {
rewrite * /metrics
reverse_proxy ssh:9222
}
}
8 changes: 0 additions & 8 deletions caddy/Caddyfile.pubsub

This file was deleted.

7 changes: 7 additions & 0 deletions cmd/pipe/ssh/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/picosh/pico/pipe"

func main() {
pipe.StartSshServer()
}
7 changes: 7 additions & 0 deletions cmd/pipe/web/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/picosh/pico/pipe"

func main() {
pipe.StartApiServer()
}
7 changes: 0 additions & 7 deletions cmd/pubsub/ssh/main.go

This file was deleted.

7 changes: 0 additions & 7 deletions cmd/pubsub/web/main.go

This file was deleted.

10 changes: 5 additions & 5 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ services:
- ./data/pastes-ssh/data:/app/ssh_data
ports:
- "2221:2222"
pubsub-web:
pipe-web:
build:
args:
APP: pubsub
APP: pipe
target: release-web
env_file:
- .env.example
ports:
- "3001:3000"
pubsub-ssh:
pipe-ssh:
build:
args:
APP: pubsub
APP: pipe
target: release-ssh
env_file:
- .env.example
volumes:
- ./data/pubsub-ssh/data:/app/ssh_data
- ./data/pipe-ssh/data:/app/ssh_data
ports:
- "2221:2222"
prose-web:
Expand Down
Loading

0 comments on commit c9b9480

Please sign in to comment.