mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-21 16:11:56 +00:00
Update scripts for new location
This commit is contained in:
parent
d268d939eb
commit
ef66e1c8df
@ -22,4 +22,6 @@ MAIL_FROM_NAME=
|
|||||||
|
|
||||||
DEV_MODE=false
|
DEV_MODE=false
|
||||||
GOSCROBBLE_DOMAIN=""
|
GOSCROBBLE_DOMAIN=""
|
||||||
STATIC_DIR="web"
|
|
||||||
|
DATA_DIR="/var/www/goscrobble-data"
|
||||||
|
FRONTEND_DIRECTORY="/var/www/goscrobble-web"
|
||||||
|
@ -5,7 +5,7 @@ variables:
|
|||||||
VERSION: 0.1.001
|
VERSION: 0.1.001
|
||||||
|
|
||||||
build-go:
|
build-go:
|
||||||
image: golang:1.16.7
|
image: golang:1.16
|
||||||
stage: build
|
stage: build
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
@ -51,10 +51,14 @@ func main() {
|
|||||||
goscrobble.RefereshExpiry = time.Duration(i) * time.Second
|
goscrobble.RefereshExpiry = time.Duration(i) * time.Second
|
||||||
}
|
}
|
||||||
|
|
||||||
goscrobble.StaticDirectory = "web"
|
goscrobble.DataDirectory = os.Getenv("DATA_DIRECTORY")
|
||||||
staticDirectoryStr := os.Getenv("STATIC_DIR")
|
if goscrobble.DataDirectory == "" {
|
||||||
if staticDirectoryStr != "" {
|
panic("DATA_DIRECTORY required in .env")
|
||||||
goscrobble.StaticDirectory = staticDirectoryStr
|
}
|
||||||
|
|
||||||
|
goscrobble.FrontendDirectory = os.Getenv("FRONTEND_DIRECTORY")
|
||||||
|
if goscrobble.FrontendDirectory == "" {
|
||||||
|
panic("FRONTEND_DIRECTORY required in .env")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore reverse proxies
|
// Ignore reverse proxies
|
||||||
|
@ -32,4 +32,7 @@ These are stored in `web/.env.production` and `web/.env.development`
|
|||||||
|
|
||||||
DEV_MODE=false // true|false - Defaults false
|
DEV_MODE=false // true|false - Defaults false
|
||||||
GOSCROBBLE_DOMAIN="" // Full domain for email links (https://goscrobble.com))
|
GOSCROBBLE_DOMAIN="" // Full domain for email links (https://goscrobble.com))
|
||||||
STATIC_DIR="web" // Location to store images (This will serve from web/static)
|
|
||||||
|
DATA_DIRECTORY="/var/www/goscrobble-data"
|
||||||
|
FRONTEND_DIRECTORY="/var/www/goscrobble-web"
|
||||||
|
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
# Easy deploy script..
|
# Easy deploy script..
|
||||||
|
|
||||||
echo 'Fetching latest git commit'
|
echo 'Fetching latest git commit'
|
||||||
|
cd /var/www/goscrobble-api
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
echo 'Building backend'
|
echo 'Building backend'
|
||||||
go build -o goscrobble cmd/go-scrobble/*.go
|
go build -o goscrobble cmd/go-scrobble/*.go
|
||||||
|
|
||||||
cd web
|
cd /var/www/goscrobble-web
|
||||||
echo 'Installing frontend packages'
|
echo 'Installing frontend packages'
|
||||||
npm install --production
|
npm install --production
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
ExecStart=/bin/bash -c 'cd /root/go-scrobble && ./goscrobble'
|
ExecStart=/bin/bash -c 'cd /var/www/goscrobble-api && ./goscrobble'
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -8,13 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func importImage(uuid string, url string) error {
|
func importImage(uuid string, url string) error {
|
||||||
// Create the file
|
// Create image
|
||||||
path, err := os.Getwd()
|
out, err := os.Create(DataDirectory + string(os.PathSeparator) + "img" + string(os.PathSeparator) + uuid + "_full.jpg")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := os.Create(path + string(os.PathSeparator) + StaticDirectory + string(os.PathSeparator) + "img" + string(os.PathSeparator) + uuid + "_full.jpg")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,9 @@ type jsonResponse struct {
|
|||||||
// List of Reverse proxies
|
// List of Reverse proxies
|
||||||
var ReverseProxies []string
|
var ReverseProxies []string
|
||||||
|
|
||||||
// Static image directory
|
// Directories
|
||||||
var StaticDirectory string
|
var FrontendDirectory string
|
||||||
|
var DataDirectory string
|
||||||
|
|
||||||
// RequestRequest - Incoming JSON!
|
// RequestRequest - Incoming JSON!
|
||||||
type RequestRequest struct {
|
type RequestRequest struct {
|
||||||
@ -96,14 +97,14 @@ func HandleRequests(port string) {
|
|||||||
r.PathPrefix("/api")
|
r.PathPrefix("/api")
|
||||||
|
|
||||||
// SERVE STATIC FILES - NO AUTH
|
// SERVE STATIC FILES - NO AUTH
|
||||||
spaStatic := spaStaticHandler{staticPath: StaticDirectory}
|
spaStatic := spaStaticHandler{staticPath: DataDirectory}
|
||||||
r.PathPrefix("/img").Handler(spaStatic)
|
r.PathPrefix("/img").Handler(spaStatic)
|
||||||
|
|
||||||
apiDocs := spaStaticHandler{staticPath: "docs/api/build"}
|
apiDocs := spaStaticHandler{staticPath: "docs/api/build"}
|
||||||
r.PathPrefix("/docs").Handler(apiDocs)
|
r.PathPrefix("/docs").Handler(apiDocs)
|
||||||
|
|
||||||
// SERVE FRONTEND - NO AUTH
|
// SERVE FRONTEND - NO AUTH
|
||||||
spa := spaHandler{staticPath: "web/build", indexPath: "index.html"}
|
spa := spaHandler{staticPath: FrontendDirectory + string(os.PathSeparator) + "build", indexPath: "index.html"}
|
||||||
r.PathPrefix("/").Handler(spa)
|
r.PathPrefix("/").Handler(spa)
|
||||||
|
|
||||||
c := cors.New(cors.Options{
|
c := cors.New(cors.Options{
|
||||||
|
Loading…
Reference in New Issue
Block a user