Compare commits

...

7 Commits

Author SHA1 Message Date
Philipp Heckel
21990398c6 Bump readme 2021-11-20 20:31:04 -05:00
Philipp Heckel
bbbab8d2ef Properly statically compile, without warnings; netgo,osusergo 2021-11-20 20:27:17 -05:00
Philipp Heckel
ad057c12c0 Statically linking go-sqlite3 2021-11-20 20:18:40 -05:00
Philipp Heckel
e3bc92e158 Update readme 2021-11-20 16:02:05 -05:00
Philipp Heckel
45f94ead8b Merge branch 'main' of github.com:binwiederhier/ntfy into main 2021-11-20 15:58:31 -05:00
Philipp Heckel
a56e1bf36d This time really 2021-11-20 15:55:30 -05:00
Philipp Heckel
fa8a7ce43e ARM builds, hopefully working 2021-11-20 15:43:15 -05:00
3 changed files with 84 additions and 28 deletions

View File

@@ -2,17 +2,44 @@ before:
hooks: hooks:
- go mod download - go mod download
builds: builds:
- binary: ntfy -
id: ntfy
binary: ntfy
env: env:
- CGO_ENABLED=1 # required for go-sqlite3 - CGO_ENABLED=1 # required for go-sqlite3
goos: tags: [sqlite_omit_load_extension,osusergo,netgo]
- linux ldflags:
goarch: - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
- amd64 goos: [linux]
goarch: [amd64]
-
id: ntfy_arm67
binary: ntfy
env:
- CGO_ENABLED=1 # required for go-sqlite3
- CC=arm-linux-gnueabi-gcc # apt install gcc-arm-linux-gnueabi
tags: [sqlite_omit_load_extension,osusergo,netgo]
ldflags:
- "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
goos: [linux]
goarch: [arm]
goarm:
- 6
- 7
-
id: ntfy_arm64
binary: ntfy
env:
- CGO_ENABLED=1 # required for go-sqlite3
- CC=aarch64-linux-gnu-gcc # apt install gcc-aarch64-linux-gnu
tags: [sqlite_omit_load_extension,osusergo,netgo]
ldflags:
- "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
goos: [linux]
goarch: [arm64]
nfpms: nfpms:
- -
package_name: ntfy package_name: ntfy
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}"
homepage: https://heckel.io/ntfy homepage: https://heckel.io/ntfy
maintainer: Philipp C. Heckel <philipp.heckel@gmail.com> maintainer: Philipp C. Heckel <philipp.heckel@gmail.com>
description: Simple pub-sub notification service description: Simple pub-sub notification service
@@ -54,6 +81,8 @@ dockers:
- dockerfile: Dockerfile - dockerfile: Dockerfile
ids: ids:
- ntfy - ntfy
goos: linux
goarch: amd64
image_templates: image_templates:
- "binwiederhier/ntfy:latest" - "binwiederhier/ntfy:latest"
- "binwiederhier/ntfy:{{ .Tag }}" - "binwiederhier/ntfy:{{ .Tag }}"

View File

@@ -61,6 +61,7 @@ coverage-html:
coverage-upload: coverage-upload:
cd build/coverage && (curl -s https://codecov.io/bash | bash) cd build/coverage && (curl -s https://codecov.io/bash | bash)
# Lint/formatting targets # Lint/formatting targets
fmt: fmt:
@@ -84,21 +85,27 @@ staticcheck: .PHONY
PATH="$(PWD)/build/staticcheck:$(PATH)" staticcheck ./... PATH="$(PWD)/build/staticcheck:$(PATH)" staticcheck ./...
rm -rf build/staticcheck rm -rf build/staticcheck
# Building targets # Building targets
build: .PHONY build-deps: .PHONY
goreleaser build --rm-dist which arm-linux-gnueabi-gcc || { echo "ERROR: ARMv6/v7 cross compiler not installed. On Ubuntu, run: apt install gcc-arm-linux-gnueabi"; exit 1; }
which aarch64-linux-gnu-gcc || { echo "ERROR: ARM64 cross compiler not installed. On Ubuntu, run: apt install gcc-aarch64-linux-gnu"; exit 1; }
build-snapshot: build: build-deps
goreleaser build --snapshot --rm-dist goreleaser build --rm-dist --debug
build-snapshot: build-deps
goreleaser build --snapshot --rm-dist --debug
build-simple: clean build-simple: clean
mkdir -p dist/ntfy_linux_amd64 mkdir -p dist/ntfy_linux_amd64
export CGO_ENABLED=1 export CGO_ENABLED=1
$(GO) build \ $(GO) build \
-o dist/ntfy_linux_amd64/ntfy \ -o dist/ntfy_linux_amd64/ntfy \
-tags sqlite_omit_load_extension,osusergo,netgo \
-ldflags \ -ldflags \
"-s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" "-linkmode=external -extldflags=-static -s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)"
clean: .PHONY clean: .PHONY
rm -rf dist build rm -rf dist build
@@ -106,11 +113,11 @@ clean: .PHONY
# Releasing targets # Releasing targets
release: release: build-deps
goreleaser release --rm-dist goreleaser release --rm-dist --debug
release-snapshot: release-snapshot: build-deps
goreleaser release --snapshot --skip-publish --rm-dist goreleaser release --snapshot --skip-publish --rm-dist --debug
# Installing targets # Installing targets

View File

@@ -2,7 +2,7 @@
# ntfy.sh | simple HTTP-based pub-sub # ntfy.sh | simple HTTP-based pub-sub
**Ntfy** (pronounce: *notify*) is a simple HTTP-based [pub-sub](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) notification service. **ntfy** (pronounce: *notify*) is a simple HTTP-based [pub-sub](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) notification service.
It allows you to **send notifications to your phone or desktop via scripts** from any computer, entirely **without signup or cost**. It allows you to **send notifications to your phone or desktop via scripts** from any computer, entirely **without signup or cost**.
It's also open source (as you can plainly see) if you want to run your own. It's also open source (as you can plainly see) if you want to run your own.
@@ -136,19 +136,29 @@ sudo apt install ntfy
**Debian/Ubuntu** (*manual install*)**:** **Debian/Ubuntu** (*manual install*)**:**
```bash ```bash
sudo apt install tmux wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.6/ntfy_1.4.6_amd64.deb
wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.3/ntfy_1.3.0_amd64.deb dpkg -i ntfy_1.4.6_amd64.deb
dpkg -i ntfy_1.4.3_amd64.deb
``` ```
**Fedora/RHEL/CentOS:** **Fedora/RHEL/CentOS:**
```bash ```bash
rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.4.3/ntfy_1.3.0_amd64.rpm rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.4.6/ntfy_1.4.6_amd64.rpm
``` ```
**Docker:** **Docker:**
Without cache:
```
docker run -p 80:80 -it binwiederhier/ntfy
```
With cache:
```bash ```bash
docker run --rm -it binwiederhier/ntfy docker run \
-v /var/cache/ntfy:/var/cache/ntfy \
-p 80:80 \
-it \
binwiederhier/ntfy \
--cache-file /var/cache/ntfy/cache.db
``` ```
**Go:** **Go:**
@@ -156,15 +166,27 @@ docker run --rm -it binwiederhier/ntfy
go get -u heckel.io/ntfy go get -u heckel.io/ntfy
``` ```
**Manual install** (*any x86_64-based Linux*)**:** **Manual install:**
```bash ```bash
wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.3/ntfy_1.3.0_linux_x86_64.tar.gz # x86_64/amd64
sudo tar -C /usr/bin -zxf ntfy_1.4.3_linux_x86_64.tar.gz ntfy wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.6/ntfy_1.4.6_linux_x86_64.tar.gz
# ARMv6
wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.6/ntfy_1.4.6_linux_armv6.tar.gz
# ARMv7
wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.6/ntfy_1.4.6_linux_armv7.tar.gz
# arm64
wget https://github.com/binwiederhier/ntfy/releases/download/v1.4.6/ntfy_1.4.6_linux_arm64.tar.gz
# Extract and run
sudo tar -C /usr/bin -zxf ntfy_1.4.6_linux_x86_64.tar.gz ntfy
./ntfy ./ntfy
``` ```
## Building ## Building
Building ntfy is simple. Here's how you do it: Building `ntfy` is simple. Here's how you do it:
``` ```
make build-simple make build-simple
@@ -174,9 +196,6 @@ make build-simple
To build releases, I use [GoReleaser](https://goreleaser.com/). If you have that installed, you can run `make build` or To build releases, I use [GoReleaser](https://goreleaser.com/). If you have that installed, you can run `make build` or
`make build-snapshot`. `make build-snapshot`.
## TODO
- add HTTPS
## Contributing ## Contributing
I welcome any and all contributions. Just create a PR or an issue. I welcome any and all contributions. Just create a PR or an issue.
@@ -192,3 +211,4 @@ Third party libraries and resources:
* [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) (MIT) is used to provide the persistent message cache * [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) (MIT) is used to provide the persistent message cache
* [Firebase Admin SDK](https://github.com/firebase/firebase-admin-go) (Apache 2.0) is used to send FCM messages * [Firebase Admin SDK](https://github.com/firebase/firebase-admin-go) (Apache 2.0) is used to send FCM messages
* [Lightbox with vanilla JS](https://yossiabramov.com/blog/vanilla-js-lightbox) * [Lightbox with vanilla JS](https://yossiabramov.com/blog/vanilla-js-lightbox)
* [Statically linking go-sqlite3](https://www.arp242.net/static-go.html)