diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..41a64d2 --- /dev/null +++ b/.env.sample @@ -0,0 +1,15 @@ +# the user ID of the running user. Applicable to Docker only. +UID= +# the group ID of the running user. Applicable to Docker only. +GID= +GEMINI_API_KEY= +# the User-Agent header that is passed to API requests sent to the MET Norway API +# see section "Identification" in https://api.met.no/doc/TermsOfService +MET_API_USER_AGENT= +# the vapid subject. this is typically the contact email of the owner of the server sending web pushes +# if you are running your own 7am instance, then it should be your email +VAPID_SUBJECT= +# vapid public/private key pair base64url encoded. you can pass "--generate-vapid-keys" to the 7am binary +# to generate one. they will be printed to stdout. +VAPID_PRIVATE_KEY_BASE64= +VAPID_PUBLIC_KEY_BASE64= diff --git a/README.md b/README.md new file mode 100644 index 0000000..f83e745 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# 7am + +[7am.is](https://7am.is) + +![](./screenshot/homepage.png) + +7am is a website that delivers daily weather summary to the user at 7am. + +It queries weather data from ACCU Weather, then uses Gemini-2.0-Flash to summarize the resulting response. +Finally, the summary is delivered to the user using the [web push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API). + +## Deploying 7am + +Before running 7am, create a `.env` file using the provided `.env.sample` file as a base template. +The sample file also contains documentation of what the variables are for. + +### Docker + +7am provides a `Dockerfile` that packages 7am into a Docker image that you can run. +You can choose to run the image as-is using `docker run`, or, you can also run it as part of a Docker Compose deployment. + +- **Volume**: 7am stores runtime data in `/app/data` within the container. The binary itself sits in `/app` +- **Port**: 7am listens on port 8080 in the container. +- **Running user**: 7am is run as `nonroot` within the container. You can pass `gid` and `uid` as build args to override the default user and group id. + +For Docker Compose users, a `docker-compose.yml` file is provided for reference. + +If you encounter permission issues, make sure that the data directory on the host is writable by the running user and group. +For example, if user id and group id `1001:1001` owns the data directory on the host, +then the running user and group in the container need to have the same user id and group id. +Use `gid` and `uid` build args to override the IDs in the container accordingly. + +### Building 7am + +To compile 7am, you need to have Go 1.24 installed. Run: + +``` +go build -o ./server +``` + +to build 7am. A binary named `server` binary will be produced (you can choose to name it to something else.) +Upon initial start up, a directory called `data` will be created in the current working directory. diff --git a/screenshot/homepage.png b/screenshot/homepage.png new file mode 100644 index 0000000..4ab3006 Binary files /dev/null and b/screenshot/homepage.png differ