diff options
| -rw-r--r-- | .runway/runway.yml | 2 | ||||
| -rw-r--r-- | Dockerfile | 14 | ||||
| -rw-r--r-- | Makefile | 15 | ||||
| -rw-r--r-- | compose.yml | 9 | ||||
| -rw-r--r-- | envoy.yml | 48 | ||||
| -rw-r--r-- | start.sh | 3 |
6 files changed, 58 insertions, 33 deletions
diff --git a/.runway/runway.yml b/.runway/runway.yml index 9fda537..a6f6515 100644 --- a/.runway/runway.yml +++ b/.runway/runway.yml @@ -7,7 +7,7 @@ metadata: owner_email_handle: mkhan product_category: authorization spec: - container_port: 80 + container_port: 10000 deployment: strategy: "expedited" regions: @@ -5,11 +5,13 @@ WORKDIR /app COPY . ./ RUN make build && mv ./sparkled /bin/sparkled -FROM scratch -ENV BIND_ADDR=":http" -EXPOSE 80 +FROM envoyproxy/envoy:v1.33-latest +ENV BIND_ADDR=":8080" +EXPOSE 8080 10000 9901 WORKDIR /var/www/ -COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=build /bin/sparkled /bin/sparkled +COPY --from=build /bin/sparkled /usr/local/bin/sparkled COPY --from=build /app/public /var/www/public -CMD ["/bin/sparkled"] +COPY envoy.yml /etc/envoy/envoy.yaml +COPY start.sh /start.sh +RUN chmod +x /start.sh +CMD ["/start.sh"] @@ -36,14 +36,7 @@ run: clean build @godotenv -f .env.local,.env ./sparkled run-image: build-image - @if [ -f ".env.local" ]; then \ - docker run --env BIND_ADDR=:http --env-file .env.local -p 8080:80 -it $(IMAGE_TAG); \ - else \ - docker run --env BIND_ADDR=:http --env-file .env -p 8080:80 -it $(IMAGE_TAG); \ - fi - -run-compose-up: - @docker compose up + @docker run --env-file .env -p 10000:10000 -p 9901:9901 -p 8080:8080 -it $(IMAGE_TAG); \ sh-image: build-builder-image @docker run -it $(IMAGE_TAG) /bin/sh @@ -51,9 +44,3 @@ sh-image: build-builder-image tidy: @go get -u ./... @go mod tidy - -run-envoy: - @docker run --rm -it -v $(pwd)/envoy.yml:/envoy.yaml -v $(pwd)/log:/log -p 9901:9901 -p 10000:10000 envoyproxy/envoy:v1.33-latest -c /envoy.yaml --log-path log/envoy.log - -validate-envoy: - @docker run --rm -it -v $(pwd)/envoy.yml:/envoy.yaml -p 9901:9901 -p 10000:10000 envoyproxy/envoy:v1.33-latest --mode validate -c /envoy.yaml diff --git a/compose.yml b/compose.yml deleted file mode 100644 index 0ee3a35..0000000 --- a/compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -services: - sparkled: - build: . - ports: - - "8080:80" - envoy: - image: "envoyproxy/envoy:v1.33-latest" - volumes: - - envoy.yml:/etc/envoy @@ -1,5 +1,47 @@ admin: + access_log_path: /tmp/admin_access.log address: - socket_address: - address: 127.0.0.1 - port_value: 9902 + socket_address: { address: 0.0.0.0, port_value: 9901 } + +static_resources: + listeners: + - name: listener_0 + address: + socket_address: { address: 0.0.0.0, port_value: 10000 } + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: ingress_http + access_log: + - name: envoy.access_loggers.stdout + typed_config: + "@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: ["*"] + routes: + - match: { prefix: "/" } + route: { cluster: sparkle } + http_filters: + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + + clusters: + - name: sparkle + connect_timeout: 0.25s + type: STRICT_DNS + lb_policy: ROUND_ROBIN + load_assignment: + cluster_name: sparkle + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: localhost + port_value: 8080 diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..14d5ce5 --- /dev/null +++ b/start.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/local/bin/sparkled & /usr/local/bin/envoy -c /etc/envoy/envoy.yaml |
