better test certs
This commit is contained in:
parent
bbf56ec34e
commit
7180ddcfbc
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,8 +1,7 @@
|
||||||
sanic
|
sanic
|
||||||
result
|
result
|
||||||
# self-signed certs for testing
|
# self-signed certs for testing
|
||||||
cert.pem
|
*.pem
|
||||||
key.pem
|
|
||||||
# test files
|
# test files
|
||||||
*.mp3
|
*.mp3
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM docker.io/golang:1.22 as builder
|
FROM docker.io/golang:alpine as builder
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
@ -18,5 +18,6 @@ COPY --from=builder /usr/src/app/sanic /sanic
|
||||||
COPY --from=builder /usr/src/app/static /static
|
COPY --from=builder /usr/src/app/static /static
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
EXPOSE 8443
|
||||||
|
|
||||||
ENTRYPOINT ["/sanic"]
|
ENTRYPOINT ["/sanic"]
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -10,6 +10,10 @@ mpd: ## Run mpd test instance
|
||||||
touch /tmp/${PROJECT}/mpd_db
|
touch /tmp/${PROJECT}/mpd_db
|
||||||
mpd --no-daemon ./mpd.conf
|
mpd --no-daemon ./mpd.conf
|
||||||
|
|
||||||
|
.PHONY: tls
|
||||||
|
tls: localhost+2.pem localhost+2-key.pem ## Create certificate and key for HTTPS
|
||||||
|
mkcert -ecdsa localhost 127.0.0.1 ::1
|
||||||
|
|
||||||
run: build ## Run project
|
run: build ## Run project
|
||||||
./${PROJECT}
|
./${PROJECT}
|
||||||
|
|
||||||
|
@ -42,7 +46,13 @@ build-container: ## Build container image
|
||||||
podman build --tag ${PROJECT}:latest .
|
podman build --tag ${PROJECT}:latest .
|
||||||
|
|
||||||
run-container: build-container ## Run container image
|
run-container: build-container ## Run container image
|
||||||
podman run --rm --volume ./config.ini:/config.ini --publish-all ${PROJECT}:latest
|
podman run --rm \
|
||||||
|
--volume ./config.ini:/config.ini \
|
||||||
|
--volume ./localhost+2.pem:/localhost+2.pem \
|
||||||
|
--volume ./localhost+2-key.pem:/localhost+2-key.pem \
|
||||||
|
--publish 8080:8080 \
|
||||||
|
--publish 8443:8443 \
|
||||||
|
${PROJECT}:latest
|
||||||
|
|
||||||
help: ## Display this help
|
help: ## Display this help
|
||||||
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
15
README.md
15
README.md
|
@ -41,7 +41,19 @@ Example flake setup (untested):
|
||||||
nixosConfigurations."myhostname".nixpkgs.lib.nixosSystem = {
|
nixosConfigurations."myhostname".nixpkgs.lib.nixosSystem = {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
{ environment.systemPackages = [ sanic.packages.${system}.default ]; }
|
{ sanic.nixosModules.default }
|
||||||
|
{ services.sanic = {
|
||||||
|
ui = {
|
||||||
|
host = "[::1]";
|
||||||
|
port = 8080;
|
||||||
|
tls = false;
|
||||||
|
};
|
||||||
|
backend = {
|
||||||
|
host = "localhost";
|
||||||
|
port = 6600;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -125,3 +137,4 @@ Made with ❤️ and ![golang logo][golang].
|
||||||
[golang]: https://go.dev/images/favicon-gopher.svg
|
[golang]: https://go.dev/images/favicon-gopher.svg
|
||||||
[mpd]: https://musicpd.org/
|
[mpd]: https://musicpd.org/
|
||||||
[mpc]: https://www.musicpd.org/clients/mpc/
|
[mpc]: https://www.musicpd.org/clients/mpc/
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ port = 6600
|
||||||
#pasword =
|
#pasword =
|
||||||
|
|
||||||
[ui]
|
[ui]
|
||||||
hostname = [::1]
|
hostname = 0.0.0.0
|
||||||
port = 443
|
port = 8443
|
||||||
tls = yes
|
tls = yes
|
||||||
cert = cert.pem
|
cert = localhost+2.pem
|
||||||
key = key.pem
|
key = localhost+2-key.pem
|
||||||
|
|
Loading…
Reference in a new issue