Compare commits
No commits in common. "2067494af48c193d30e9569eca6b70b190e4ed74" and "1d90400ba35e87d68f27fb747807a108d1dd9c81" have entirely different histories.
2067494af4
...
1d90400ba3
@ -30,7 +30,7 @@ To get started, you first need to have Go installed. GTS was developed with Go 1
|
|||||||
|
|
||||||
Once you've got go installed, clone this repository into your Go path. Normally, this should be `~/go/src/github.com/superseriousbusiness/gotosocial`.
|
Once you've got go installed, clone this repository into your Go path. Normally, this should be `~/go/src/github.com/superseriousbusiness/gotosocial`.
|
||||||
|
|
||||||
Once that's done, you can try building the project: `./build.sh`. This will build the `gotosocial` binary.
|
Once that's done, you can try building the project: `go build ./cmd/gotosocial`. This will build the `gotosocial` binary.
|
||||||
|
|
||||||
If there are no errors, great, you're good to go!
|
If there are no errors, great, you're good to go!
|
||||||
|
|
||||||
|
11
Dockerfile
11
Dockerfile
@ -1,6 +1,4 @@
|
|||||||
FROM golang:1.16.4-alpine3.13 AS builder
|
FROM golang:1.16.4-alpine3.13 AS builder
|
||||||
RUN apk update && apk upgrade --no-cache
|
|
||||||
RUN apk add git
|
|
||||||
|
|
||||||
# create build dir
|
# create build dir
|
||||||
RUN mkdir -p /go/src/github.com/superseriousbusiness/gotosocial
|
RUN mkdir -p /go/src/github.com/superseriousbusiness/gotosocial
|
||||||
@ -13,15 +11,8 @@ ADD testrig /go/src/github.com/superseriousbusiness/gotosocial/testrig
|
|||||||
ADD go.mod /go/src/github.com/superseriousbusiness/gotosocial/go.mod
|
ADD go.mod /go/src/github.com/superseriousbusiness/gotosocial/go.mod
|
||||||
ADD go.sum /go/src/github.com/superseriousbusiness/gotosocial/go.sum
|
ADD go.sum /go/src/github.com/superseriousbusiness/gotosocial/go.sum
|
||||||
|
|
||||||
# move .git dir and version for versioning
|
|
||||||
ADD .git /go/src/github.com/superseriousbusiness/gotosocial/.git
|
|
||||||
ADD version /go/src/github.com/superseriousbusiness/gotosocial/version
|
|
||||||
|
|
||||||
# move the build script
|
|
||||||
ADD build.sh /go/src/github.com/superseriousbusiness/gotosocial/build.sh
|
|
||||||
|
|
||||||
# do the build step
|
# do the build step
|
||||||
RUN ./build.sh
|
RUN go build ./cmd/gotosocial
|
||||||
|
|
||||||
FROM alpine:3.13 AS executor
|
FROM alpine:3.13 AS executor
|
||||||
RUN apk update && apk upgrade --no-cache
|
RUN apk update && apk upgrade --no-cache
|
||||||
|
@ -30,11 +30,7 @@ docker run -d --network host --user postgres -e POSTGRES_PASSWORD=some_password
|
|||||||
|
|
||||||
### 5: Build the Binary
|
### 5: Build the Binary
|
||||||
|
|
||||||
On your local machine (not your server), with Go installed, clone the GoToSocial repository, and build the binary with the provided build script:
|
On your local machine (not your server), with Go installed, clone the GoToSocial repository, and build the binary with `go build ./cmd/gotosocial`.
|
||||||
|
|
||||||
```bash
|
|
||||||
./build/sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6: Prepare VPS
|
### 6: Prepare VPS
|
||||||
|
|
||||||
|
8
build.sh
8
build.sh
@ -1,8 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
export COMMIT=$(git rev-list -1 HEAD)
|
|
||||||
export VERSION=$(cat ./version)
|
|
||||||
|
|
||||||
go build -ldflags="-X 'main.Commit=$COMMIT' -X 'main.Version=$VERSION'" ./cmd/gotosocial
|
|
@ -33,18 +33,11 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is the software version of GtS being used
|
|
||||||
var Version string
|
|
||||||
|
|
||||||
// Commit is the git commit of GtS being used
|
|
||||||
var Commit string
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flagNames := config.GetFlagNames()
|
flagNames := config.GetFlagNames()
|
||||||
envNames := config.GetEnvNames()
|
envNames := config.GetEnvNames()
|
||||||
defaults := config.GetDefaults()
|
defaults := config.GetDefaults()
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Version: Version + " " + Commit[:7],
|
|
||||||
Usage: "a fediverse social media server",
|
Usage: "a fediverse social media server",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
// GENERAL FLAGS
|
// GENERAL FLAGS
|
||||||
@ -406,7 +399,7 @@ func runAction(c *cli.Context, a cliactions.GTSAction) error {
|
|||||||
return fmt.Errorf("error creating config: %s", err)
|
return fmt.Errorf("error creating config: %s", err)
|
||||||
}
|
}
|
||||||
// ... and the flags set on the *cli.Context by urfave
|
// ... and the flags set on the *cli.Context by urfave
|
||||||
if err := conf.ParseCLIFlags(c, c.App.Version); err != nil {
|
if err := conf.ParseCLIFlags(c); err != nil {
|
||||||
return fmt.Errorf("error parsing config: %s", err)
|
return fmt.Errorf("error parsing config: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func loadFromFile(path string) (*Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ParseCLIFlags sets flags on the config using the provided Flags object
|
// ParseCLIFlags sets flags on the config using the provided Flags object
|
||||||
func (c *Config) ParseCLIFlags(f KeyedFlags, version string) error {
|
func (c *Config) ParseCLIFlags(f KeyedFlags) error {
|
||||||
fn := GetFlagNames()
|
fn := GetFlagNames()
|
||||||
|
|
||||||
// For all of these flags, we only want to set them on the config if:
|
// For all of these flags, we only want to set them on the config if:
|
||||||
@ -261,8 +261,6 @@ func (c *Config) ParseCLIFlags(f KeyedFlags, version string) error {
|
|||||||
c.AccountCLIFlags[EmailFlag] = f.String(EmailFlag)
|
c.AccountCLIFlags[EmailFlag] = f.String(EmailFlag)
|
||||||
c.AccountCLIFlags[PasswordFlag] = f.String(PasswordFlag)
|
c.AccountCLIFlags[PasswordFlag] = f.String(PasswordFlag)
|
||||||
|
|
||||||
c.SoftwareVersion = version
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
|
const softwareVersion = "0.1.0-SNAPSHOT"
|
||||||
|
|
||||||
// TestDefault returns a default config for testing
|
// TestDefault returns a default config for testing
|
||||||
func TestDefault() *Config {
|
func TestDefault() *Config {
|
||||||
defaults := GetTestDefaults()
|
defaults := GetTestDefaults()
|
||||||
@ -119,6 +121,7 @@ func GetDefaults() Defaults {
|
|||||||
ConfigPath: "",
|
ConfigPath: "",
|
||||||
Host: "",
|
Host: "",
|
||||||
Protocol: "https",
|
Protocol: "https",
|
||||||
|
SoftwareVersion: softwareVersion,
|
||||||
|
|
||||||
DbType: "postgres",
|
DbType: "postgres",
|
||||||
DbAddress: "localhost",
|
DbAddress: "localhost",
|
||||||
@ -165,6 +168,7 @@ func GetTestDefaults() Defaults {
|
|||||||
ConfigPath: "",
|
ConfigPath: "",
|
||||||
Host: "localhost:8080",
|
Host: "localhost:8080",
|
||||||
Protocol: "http",
|
Protocol: "http",
|
||||||
|
SoftwareVersion: softwareVersion,
|
||||||
|
|
||||||
DbType: "postgres",
|
DbType: "postgres",
|
||||||
DbAddress: "localhost",
|
DbAddress: "localhost",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</aside>
|
</aside>
|
||||||
<section>
|
<section>
|
||||||
<h1>404: Page Not Found</h1>
|
<h1>404: Page Not Found</h1>
|
||||||
If you believe this was an error, you can <a href="{{.instance.ContactAccount.URL}}">contact an admin</a>
|
If you believe this was an error, you can <a href="/{{.instance.ContactAccount}}">contact an admin</a>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{ template "footer.tmpl" .}}
|
{{ template "footer.tmpl" .}}
|
@ -1,7 +1,7 @@
|
|||||||
<!-- footer.tmpl -->
|
<!-- footer.tmpl -->
|
||||||
<footer>
|
<footer>
|
||||||
<div id="version">
|
<div id="version">
|
||||||
GoToSocial: <span class="accent">{{.instance.Version}}</span><br>
|
Running GoToSocial version: <span class="accent">{{.instance.Version}}</span><br>
|
||||||
<a href="https://github.com/superseriousbusiness/gotosocial">Source Code</a>
|
<a href="https://github.com/superseriousbusiness/gotosocial">Source Code</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="contact">
|
<div id="contact">
|
||||||
|
Loading…
Reference in New Issue
Block a user