Updated installation instructions

This commit is contained in:
Eduard Urbach 2019-04-14 16:28:30 +09:00
parent ba8d7e72d3
commit c210ab36ee
6 changed files with 42 additions and 112 deletions

View File

@ -1,33 +1,9 @@
# Install development environment
FROM golang:1.12.2-alpine as builder
ENV GO111MODULE=on
RUN apk add --no-cache git nodejs npm make gcc musl-dev && \
npm i -g typescript && \
go install github.com/aerogo/pack && \
go install github.com/aerogo/run && \
go install golang.org/x/tools/cmd/goimports && \
git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn
WORKDIR /notify.moe
FROM blitzprog/aero
RUN git clone --progress --verbose --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn
# Download dependencies when go.mod or go.sum changes
COPY go.mod go.sum ./
RUN go mod download
# Run Typescript compiler when scripts change
COPY ./tsconfig.json ./
COPY ./scripts ./scripts
RUN tsc
# Build
COPY . ./
RUN pack && \
go build
# Production
FROM alpine:latest as production
RUN apk add --no-cache ca-certificates
COPY --from=builder /root/.aero /root/.aero
COPY --from=builder /notify.moe /notify.moe
ENV ARN_ROOT=/notify.moe
WORKDIR /notify.moe
ENTRYPOINT ["./notify.moe"]
# Expect ~/notify.moe to be mounted as a volume
RUN cd ~/notify.moe && \
tsc && \
pack && \
go build

View File

@ -6,15 +6,24 @@
## Prerequisites
* Install [Ubuntu](https://www.ubuntu.com/) or [MacOS](https://en.wikipedia.org/wiki/MacOS)
* Install [Go](https://golang.org/dl/)
* Install [TypeScript](https://www.typescriptlang.org/)
* Install [Git LFS](https://git-lfs.github.com/)
* Install [Docker](https://www.docker.com/get-started) and [Compose](https://docs.docker.com/compose/install/)
## Start the installation
## Clone the repository
```bash
curl -s https://raw.githubusercontent.com/animenotifier/notify.moe/go/install.sh | bash
git clone https://github.com/animenotifier/notify.moe.git
```
## Download the dev image
```bash
docker pull animenotifier/notify.moe
```
## Run the dev image
```bash
docker-compose run notify.moe
```
## Run the server

View File

@ -1,6 +1,9 @@
version: '3'
version: "3"
services:
notify.moe:
build: .
image: animenotifier/notify.moe
stdin_open: true
tty: true
ports:
- "443:4001"

6
go.mod
View File

@ -25,10 +25,13 @@ require (
github.com/blitzprog/color v1.8.0
github.com/bwmarrin/discordgo v0.19.0
github.com/dustin/go-humanize v1.0.0
github.com/elazarl/goproxy v0.0.0-20190410145444-c548f45dcf1d // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190410145444-c548f45dcf1d // indirect
github.com/go-ini/ini v1.42.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/golang/protobuf v1.3.1 // indirect
github.com/gomodule/oauth1 v0.0.0-20181215000758-9a59ed3b0a84
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e // indirect
github.com/graphql-go/graphql v0.7.8
github.com/json-iterator/go v1.1.6
github.com/kr/pretty v0.1.0 // indirect
@ -47,7 +50,8 @@ require (
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a // indirect
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369 // indirect
golang.org/x/sync v0.0.0-20190412183630-56d357773e84 // indirect
golang.org/x/sys v0.0.0-20190412213103-97732733099d // indirect
google.golang.org/appengine v1.5.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/ini.v1 v1.42.0 // indirect

13
go.sum
View File

@ -102,6 +102,10 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/elazarl/goproxy v0.0.0-20181111060418-2ce16c963a8a h1:A4wNiqeKqU56ZhtnzJCTyPZ1+cyu8jKtIchQ3TtxHgw=
github.com/elazarl/goproxy v0.0.0-20181111060418-2ce16c963a8a/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy v0.0.0-20190410145444-c548f45dcf1d h1:FEw1BeUVT/wxetVmacXPqQgRyYCG+0aCfQel+53Pa/E=
github.com/elazarl/goproxy v0.0.0-20190410145444-c548f45dcf1d/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy/ext v0.0.0-20190410145444-c548f45dcf1d h1:G71TTAuHFAHgY2X7zfUWDbogxiZuLvpJ9xevbOw4Vcw=
github.com/elazarl/goproxy/ext v0.0.0-20190410145444-c548f45dcf1d/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-ini/ini v1.42.0 h1:TWr1wGj35+UiWHlBA8er89seFXxzwFn11spilrrj+38=
github.com/go-ini/ini v1.42.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
@ -133,6 +137,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190328170749-bb2674552d8f h1:4Gslotqbs16iAg+1KR/XdabIfq8TlAWHdwS5QJFksLc=
github.com/gopherjs/gopherjs v0.0.0-20190328170749-bb2674552d8f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e h1:XWcjeEtTFTOVA9Fs1w7n2XBftk5ib4oZrhzWk0B+3eA=
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
@ -213,6 +219,7 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
github.com/russross/blackfriday v2.0.0+incompatible h1:cBXrhZNUf9C+La9/YpS+UHpUT8YD6Td9ZMSU9APFcsk=
github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM=
@ -299,6 +306,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190412183630-56d357773e84 h1:IqXQ59gzdXv58Jmm2xn0tSOR9i6HqroaOFRQ3wR/dJQ=
golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -310,8 +319,8 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 h1:hOY+O8MxdkPV10pNf7/XEHaySCiPKxixMKUshfHsGn0=
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369 h1:aBlRBZoCuZNRDClvfkDoklQqdLzBaA3uViASg2z2p24=
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=

View File

@ -1,71 +0,0 @@
#!/bin/bash
echo "Checking prerequisites..."
if hash go 2>/dev/null; then
if [[ ":$PATH:" == *":$GOPATH/bin:"* || ":$PATH:" == *":$GOPATH/bin/:"* ]]; then
go version
else
echo "Your \$PATH is missing \$GOPATH/bin, you should add this to your ~/.profile:"
echo "export PATH=\$PATH:/usr/local/go/bin:\$GOPATH/bin"
exit
fi
else
echo "Go is not installed"
exit
fi
if hash tsc 2>/dev/null; then
tsc --version
else
echo "TypeScript is not installed"
exit
fi
if hash git 2>/dev/null; then
git version
else
echo "Git is not installed"
exit
fi
if hash git-lfs 2>/dev/null; then
git lfs version
else
echo "Git LFS is not installed"
exit
fi
echo "Looks like the prerequisites were installed correctly!"
# Use sudo here to request permissions for later
sudo echo "---"
# Humanize library is only used in templates
go get -v github.com/dustin/go-humanize
# Clone and build main repository
go get -t -v github.com/animenotifier/notify.moe/...
cd $GOPATH/src/github.com/animenotifier/notify.moe
make all
# Database
git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn
# Configure
make ports
# Add "127.0.0.1 beta.notify.moe" to /etc/hosts
if grep -Fxq "127.0.0.1 beta.notify.moe" /etc/hosts; then
echo "beta.notify.moe already resolves to localhost"
else
sudo -- sh -c -e "echo '127.0.0.1 beta.notify.moe' >> /etc/hosts"
echo "beta.notify.moe now resolves to localhost"
fi
# Test
make test
# Finished
echo "Finished installation."
echo "You can now execute the 'run' command and open https://beta.notify.moe in your browser."