go-shiori / shiori

Simple bookmark manager built with Go
MIT License
9.29k stars 552 forks source link

How to setup Shiori on a Raspberry Pi #243

Closed szethh closed 3 years ago

szethh commented 4 years ago

How can I install in a Raspberry Pi? I've tried building from source using Go. No luck. I also tried building the dockerfile provided, as well as this modification by 5hay. Neither worked.

Does anyone know how to install it on Raspbian?

NoverNobida commented 4 years ago

Maybe you can pull docker images(such as radhifadlillah/shiori) directly?

szethh commented 4 years ago

So I tried to pull the image with docker pull radhifadlillah/shiori and then run it with docker run --publish 80:80 --name shiori radhifadlillah/shiori, but it returns standard_init_linux.go:211: exec user process caused "exec format error"

When running docker ps -a it shows that the last command was /usr/bin/dumb-init -- /usr/local/bin/shiori serve.

Pixtriks commented 4 years ago

Yeah that's because the image has only been built for amd64. You can build it yourself using the Dockerfile which will result in an arm image.

szethh commented 4 years ago

I've already tried that. Not working :/

veverkap commented 4 years ago

I've also tried to build locally on a Pi 4 32bit using the Dockerfile and I get this error:

github.com/spf13/pflag (download)
Fetching https://golang.org/x/crypto/ssh/terminal?go-get=1
Parsing meta tags from https://golang.org/x/crypto/ssh/terminal?go-get=1 (status code 200)
get "golang.org/x/crypto/ssh/terminal": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ssh/terminal?go-get=1
get "golang.org/x/crypto/ssh/terminal": verifying non-authoritative meta tag
github.com/go-sql-driver/mysql (download)
github.com/lib/pq (download)
github.com/mattn/go-sqlite3 (download)
github.com/shurcooL/vfsgen (download)
github.com/shurcooL/httpfs (download)
src/github.com/RadhiFadlillah/shiori/main.go:6:2: use of internal package not allowed
The command '/bin/sh -c go get -d -v github.com/RadhiFadlillah/shiori' returned a non-zero code: 1
microcreators commented 4 years ago

I have built it on arm7 (RPi3). A standalone bin. What's wrong?

veverkap commented 4 years ago

I'm trying to build using the Dockerfile - I'm not compiling directly on the RPI - I don't even have go installed on the PI

microcreators commented 4 years ago

Apologies, can't help with docker. But for @MateoPeri , you need a newer go version than in raspbian repos (assuming you use it). After that, building wen smooth. I'm ongo1.14.1 linux/arm Also: https://github.com/go-shiori/shiori/issues/234#issue-586315408

lapwat commented 4 years ago

Try to replace the Dockerfile with this one:

# build stage
FROM golang:alpine AS builder
RUN apk add --no-cache build-base
WORKDIR /src
COPY . .
RUN GOOS=linux GOARCH=arm GOARM=5 go build

# server image
FROM golang:alpine
COPY --from=builder /src/shiori /usr/local/bin/
ENV SHIORI_DIR /srv/shiori/
EXPOSE 8080
CMD ["/usr/local/bin/shiori", "serve"]

Build and run:

docker build -t shiori .
docker run -p 4444:8080 shiori

It should build for Raspberry and be available at http://localhost:4444

clach04 commented 4 years ago

I have some notes in #268 too

tiagosvf commented 4 years ago

Try to replace the Dockerfile with this one:

# build stage
FROM golang:alpine AS builder
RUN apk add --no-cache build-base
WORKDIR /src
COPY . .
RUN GOOS=linux GOARCH=arm GOARM=5 go build

# server image
FROM golang:alpine
COPY --from=builder /src/shiori /usr/local/bin/
ENV SHIORI_DIR /srv/shiori/
EXPOSE 8080
CMD ["/usr/local/bin/shiori", "serve"]

Build and run:

docker build -t shiori .
docker run -p 4444:8080 shiori

It should build for Raspberry and be available at http://localhost:4444

@lapwat

Running image built from that Dockerfile gives me

panic: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub

goroutine 1 [running]:
github.com/jmoiron/sqlx.MustConnect(...)
        /go/pkg/mod/github.com/jmoiron/sqlx@v1.2.0/sqlx.go:650
github.com/go-shiori/shiori/internal/database.OpenSQLiteDatabase(0x101bbc0, 0x15, 0x0, 0x0, 0x0)
        /src/internal/database/sqlite.go:23 +0x384
github.com/go-shiori/shiori/internal/cmd.openSQLiteDatabase(0x575b8c, 0xb, 0x0, 0x0)
        /src/internal/cmd/root.go:116 +0x70
github.com/go-shiori/shiori/internal/cmd.openDatabase(0x101a04b, 0xc, 0x1ff, 0x0)
        /src/internal/cmd/root.go:110 +0x74
github.com/go-shiori/shiori/internal/cmd.preRunRootHandler(0x1089180, 0xa64eb8, 0x0, 0x0)
        /src/internal/cmd/root.go:63 +0x174
github.com/spf13/cobra.(*Command).execute(0x1089180, 0xa64eb8, 0x0, 0x0, 0x1089180, 0xa64eb8)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:810 +0x17c
github.com/spf13/cobra.(*Command).ExecuteC(0x1088640, 0x0, 0x0, 0x46ae8)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x238
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
        /src/main.go:19 +0x18
lapwat commented 4 years ago

@tiagosvf I thought it would work but it is not possible apparently: https://github.com/go-shiori/shiori/issues/254#issuecomment-670203877

theryecatcher commented 3 years ago

Is this still an issue I have a fully functioning interface on RPi4 (arm64v8 running Ubuntu - but I don't think that matters). Didn't do anything just built the Dockerfile on the Pi and it was up.

tiagosvf commented 3 years ago

@theryecatcher There haven't been any commits since my last answer so this is still an issue

jcm4atx commented 3 years ago

I'm running without any issues on my Pi. I used the Go installation, not Docker.

# Install Snap
sudo apt install -y snapd
# Install Go
sudo snap install go --classic
# Install Shiori
go get -u -v github.com/go-shiori/shiori
cd /home/pi/go/src/github.com/go-shiori/shiori && go build

I recommend adding this line to your .bash_aliases file.

alias shiori='/home/pi/go/src/github.com/go-shiori/shiori/shiori'

atsai1220 commented 3 years ago

This image worked for me on my rpi4. malitov/rpi-shiori

docker run -d  --rm --name shiori -p 8081:8080 -v $(pwd):/srv/shiori malitov/rpi-shiori

pi@raspberrypi:~/shiori $ docker ps
CONTAINER ID   IMAGE                                COMMAND                  CREATED              STATUS                PORTS                                            NAMES
a1c593682354   malitov/rpi-shiori                   "/usr/local/bin/shio…"   About a minute ago   Up About a minute     0.0.0.0:8081->8080/tcp                           shiori
bonnebulle commented 1 year ago

It's amazing making it running on Raspberry ! Do anybody here know if https://hub.docker.com/r/malitov/rpi-shiori is up to date ? Thanks