+12
-4
Dockerfile
+12
-4
Dockerfile
···
1
-
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:latest as builder
1
+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.24.3-alpine3.21 as builder
2
2
3
3
ARG TARGETPLATFORM
4
4
ARG BUILDPLATFORM
5
5
ARG TARGETOS
6
6
ARG TARGETARCH
7
7
8
+
#needed for sqlite
9
+
RUN apk add --update gcc musl-dev
10
+
8
11
# step 1. dep cache
9
12
WORKDIR /app
10
13
ARG TARGETPLATFORM=${BUILDPLATFORM:-linux/amd64}
···
14
17
# step 2. build the actual app
15
18
WORKDIR /app
16
19
COPY . .
17
-
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o main ./cmd
20
+
#generate the jwks
21
+
RUN go run github.com/haileyok/atproto-oauth-golang/cmd/helper generate-jwks
22
+
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags='-w -s -extldflags "-static"' -o main ./cmd
18
23
ARG TARGETOS=${TARGETPLATFORM%%/*}
19
24
ARG TARGETARCH=${TARGETPLATFORM##*/}
20
25
21
-
FROM --platform=${TARGETPLATFORM:-linux/amd64} scratch
22
-
WORKDIR /app/
26
+
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.21
27
+
#Creates an empty /db folder for docker compose
28
+
WORKDIR /db
29
+
WORKDIR /app
23
30
COPY --from=builder /app/main /app/main
31
+
COPY --from=builder /app/jwks.json /app/jwks.json
24
32
ENTRYPOINT ["/app/main"]
+40
-2
README.md
+40
-2
README.md
···
9
9
10
10
well its just a work in progress... we build in the open!
11
11
12
+
## Setup
13
+
It is recommend to have port forward url while working with piper. Development or running from docker because of external callbacks.
14
+
15
+
You have a couple of options
16
+
1. Setup the traditional port forward on your router
17
+
2. Use a tool like [ngrok](https://ngrok.com/) with the command `ngrok http 8080` or [Cloudflare tunnels](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/) (follow the 2a. portion of the guide when you get to that point)
18
+
19
+
Either way make note of what the publicly accessible domain name is for setting up env variables. It will be something like `https://piper.teal.fm` that you can access publicly
20
+
21
+
#### env variables
22
+
Copy [.env.template](.env.template) and name it [.env](.env)
23
+
24
+
This is a break down of what each env variable is and what it may look like
25
+
26
+
- `SERVER_PORT` - The port piper is hosted on
27
+
- `SERVER_HOST` - The server host. `localhost` is fine here, or `0.0.0.0` for docker
28
+
- `SERVER_ROOT_URL` - This needs to be the pubically accessible url created in [Setup](#setup). Like `https://piper.teal.fm`
29
+
- `SPOTIFY_CLIENT_ID` - Client Id from setup in [Spotify developer dashboard](https://developer.spotify.com/documentation/web-api/tutorials/getting-started)
30
+
- `SPOTIFY_CLIENT_SECRET` - Client Secret from setup in [Spotify developer dashboard](https://developer.spotify.com/documentation/web-api/tutorials/getting-started)
31
+
- `SPOTIFY_AUTH_URL` - most likely `https://accounts.spotify.com/authorize`
32
+
- `SPOTIFY_TOKEN_URL` - most likely `https://accounts.spotify.com/api/token`
33
+
- `SPOTIFY_SCOPES` - most likely `user-read-currently-playing user-read-email`
34
+
- `CALLBACK_SPOTIFY` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/callback/spotify`
35
+
36
+
- `ATPROTO_CLIENT_ID` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/.well-known/client-metadata.json`
37
+
- `ATPROTO_METADATA_URL` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/.well-known/client-metadata.json`
38
+
- `ATPROTO_CALLBACK_URL` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/callback/atproto`
39
+
40
+
- `LASTFM_API_KEY` - Your lastfm api key. Can find out how to setup [here](https://www.last.fm/api)
41
+
42
+
- `TRACKER_INTERVAL` - How long between checks to see if the registered users are listening to new music
43
+
- `DB_PATH`= Path for the sqlite db. If you are using the docker compose probably want `/db/piper.db` to persist data
44
+
45
+
46
+
12
47
#### development
48
+
49
+
make sure you have your env setup following [the env var setup](#env-variables)
13
50
14
51
assuming you have go installed and set up properly:
15
52
···
36
73
air should automatically build and run piper, and watch for changes on relevant files.
37
74
38
75
#### docker
39
-
40
-
TODO
76
+
We also provide a docker compose file to use to run piper locally. There are a few edits to the [.env](.env) to make it run smoother in a container
77
+
`SERVER_HOST`- `0.0.0.0`
78
+
`DB_PATH` = `/db/piper.db` to persist your piper db through container restarts
+18
compose.yml
+18
compose.yml