Skip to content

Commit 211bda7

Browse files
committed
Remove caddy and all omnibus references.
Signed-off-by: Gregory Schofield <greg.c.schofield@gmail.com>
1 parent e69b928 commit 211bda7

File tree

19 files changed

+94
-235
lines changed

19 files changed

+94
-235
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
type: string
1616
default: ${{ github.ref }}
1717

18+
env:
19+
GO_VERSION: '1.22'
20+
RUBY_VERSION: '3.4'
21+
1822
jobs:
1923

2024
build:
@@ -28,7 +32,7 @@ jobs:
2832
- name: Set up Go
2933
uses: actions/setup-go@v5
3034
with:
31-
go-version: '1.22'
35+
go-version: ${{ env.GO_VERSION }}
3236
- name: Set up ko
3337
uses: ko-build/setup-ko@v0.9
3438
- name: Go format check
@@ -50,10 +54,10 @@ jobs:
5054
args: release --skip validate --skip archive --clean --snapshot
5155
env:
5256
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
KO_DOCKER_REPO: goreleaser.ko.local/gemfast
57+
KO_DOCKER_REPO: goreleaser.ko.local
5458
- name: Save docker image
5559
run: |
56-
docker save goreleaser.ko.local/gemfast/server:latest > gemfast-PR-${{ github.sha }}.tar
60+
docker save goreleaser.ko.local/server:latest > gemfast-PR-${{ github.sha }}.tar
5761
- name: Upload docker image
5862
uses: actions/upload-artifact@v4
5963
with:

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ prerelease_specs*
44
*.gem
55
!test/fixtures/gem_list/*.gem
66
gemfast.db
7-
bin/gemfast-server
87
omnibus/pkg
98
tmp
109
!test/fixtures/spec/*.gem
11-
dist/
10+
dist/
11+
bin/

Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

Makefile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
.PHONY: all omnibus test clean
1+
.PHONY: all test clean
22

33
build:
4-
go build -mod=mod
5-
mv server bin/gemfast-server
6-
chmod +x bin/gemfast-server
7-
8-
omnibus:
9-
cd omnibus && bundle install
10-
cd omnibus && bundle exec omnibus build gemfast
4+
go build -o bin/gemfast-server main.go
115

126
run:
13-
go run -mod=mod main.go start
7+
go run main.go start
148

159
fmt:
1610
go fmt ./...
1711

1812
test:
19-
go test -mod=mod ./...
13+
go test ./...
14+
15+
vet:
16+
go vet ./...
2017

2118
clean:
2219
go clean

README.md

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
- [Gemfast](#gemfast)
66
- [Why Gemfast](#why-gemfast)
77
- [Installing](#installing)
8-
- [Debian Package](#debian-package)
9-
- [Debian Package SSL](#debian-package-ssl)
108
- [Docker](#docker)
9+
- [Prebuilt Binaries](#prebuilt-binaries)
1110
- [Building From Source](#building-from-source)
1211
- [Docs](#docs)
1312
- [UI](#ui)
@@ -19,41 +18,23 @@ Gemfast was created for users who need to self-host their rubygems and want some
1918

2019
Gemfast has the following unique benefits:
2120

22-
* Two installation methods: [Debian Package](#debian-package) and [Docker Image](#docker)
21+
* Two installation methods: [Docker Image](#docker) or precompiled binaries
2322
* No need to install/upgrade/manage a version of Ruby on the server
2423
* No external server dependencies like postgres, redis or memcached
25-
* Automatic HTTPS via Caddy
2624
* User login via GitHub oAuth
27-
* No external server dependencies like postgres, redis or memcached
2825
* Allow/Deny gems based on CVE severity or a regex list using the [ruby-advisory-db](https://github.com/rubysec/ruby-advisory-db)
29-
* Go is generally faster and requires less memory then Ruby (still :heart: Ruby though)
26+
* Performance benefits of Go
3027

3128
## Installing
3229

33-
Gemfast is currently distributed in two different ways, a `.deb` package and a `docker` image.
34-
35-
The `.deb` package includes a web server which proxies HTTPS traffic to Gemfast and is recommended when installing Gemfast on a virtual machine or bare-metal instance.
36-
37-
### Debian Package
38-
39-
To install the .deb package, download it from the latest GitHub release and install it with dpkg.
40-
41-
```bash
42-
curl -L -O gemfast_<version>_amd64.deb
43-
sudo dpkg -i ./gemfast_<version>_amd64.deb
44-
sudo systemctl start gemfast.service
45-
```
46-
47-
#### Debian Package SSL
48-
49-
The Gemfast `.deb` package includes Caddy Server which will automatically generate and manage a let's encrypt SSL certificate for your server. Caddy offers a few ways to generate a valid SSL certificate, see: https://caddyserver.com/docs/automatic-https#acme-challenges. If the let's encrypt challenge fails, the server will use a self-signed certificate.
30+
Gemfast is currently distributed in two different ways, a `docker` image and precompiled binaries.
5031

5132
### Docker
5233

5334
When running Gemfast as a container, its important to mount the following directories:
5435

55-
* /etc/gemfast - The directory for the gemfast.hcl config file
5636
* /var/gemfast - The directory for the Gemfast data including gems and database
37+
* /etc/gemfast - The directory for the gemfast.hcl config file. It is possible to configure the config file path using `env GEMFAST_CONFIG_FILE=/path/to/my/file.hcl`
5738

5839
```bash
5940
docker run -d --name gemfast-server \
@@ -63,6 +44,16 @@ docker run -d --name gemfast-server \
6344
ghcr.io/gemfast/server:latest
6445
```
6546

47+
### Prebuilt Binaries
48+
49+
Currently Prebuild binaries are available on each GitHub release for the following platforms.
50+
51+
- linux_amd64
52+
- linux_arm64
53+
- darwin_arm64
54+
55+
Simply download and extract the tarball to run the server.
56+
6657
### Building From Source
6758

6859
Gemfast uses Make to build binaries. To build and run a static binary:

bin/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmd/gemfast-server/caddyfile.go

Lines changed: 0 additions & 73 deletions
This file was deleted.

cmd/gemfast-server/start.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"os"
45
"time"
56

67
"github.com/gemfast/server/internal/api"
@@ -22,11 +23,17 @@ var startCmd = &cobra.Command{
2223
},
2324
}
2425

26+
var configPath string
27+
2528
func init() {
29+
startCmd.Flags().StringVarP(&configPath, "config", "c", "", "Path to the config file")
2630
rootCmd.AddCommand(startCmd)
2731
}
2832

2933
func start() {
34+
if configPath != "" {
35+
os.Setenv("GEMFAST_CONFIG_FILE", configPath)
36+
}
3037
// Load the config
3138
cfg := config.NewConfig()
3239
log.Info().Msg("starting services")

internal/config/config.go

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ type Config struct {
2424
UIDisabled bool `hcl:"ui_disabled,optional"`
2525
MetricsDisabled bool `hcl:"metrics_disabled,optional"`
2626

27-
LicenseKey string `hcl:"license_key,optional"`
28-
CaddyConfig *CaddyConfig `hcl:"caddy,block"`
29-
Mirrors []*MirrorConfig `hcl:"mirror,block"`
30-
Filter *FilterConfig `hcl:"filter,block"`
31-
CVE *CVEConfig `hcl:"cve,block"`
32-
Auth *AuthConfig `hcl:"auth,block"`
33-
}
34-
35-
type CaddyConfig struct {
36-
AdminAPIEnabled bool `hcl:"admin_api_enabled,optional"`
37-
MetricsDisabled bool `hcl:"metrics_disabled,optional"`
38-
Host string `hcl:"host,optional"`
39-
Port int `hcl:"port,optional"`
27+
LicenseKey string `hcl:"license_key,optional"`
28+
Mirrors []*MirrorConfig `hcl:"mirror,block"`
29+
Filter *FilterConfig `hcl:"filter,block"`
30+
CVE *CVEConfig `hcl:"cve,block"`
31+
Auth *AuthConfig `hcl:"auth,block"`
4032
}
4133

4234
type MirrorConfig struct {
@@ -114,7 +106,6 @@ func NewConfig() *Config {
114106

115107
func (c *Config) setDefaultConfig() {
116108
c.setDefaultServerConfig()
117-
c.setDefaultCaddyConfig()
118109
c.setDefaultMirrorConfig()
119110
c.setDefaultAuthConfig()
120111
c.setDefaultFilterConfig()
@@ -142,25 +133,6 @@ func (c *Config) setDefaultServerConfig() {
142133
c.PrivateGemsNamespace = "private"
143134
}
144135
}
145-
146-
func (c *Config) setDefaultCaddyConfig() {
147-
if c.CaddyConfig == nil {
148-
c.CaddyConfig = &CaddyConfig{
149-
AdminAPIEnabled: false,
150-
MetricsDisabled: false,
151-
Host: "https://localhost",
152-
Port: 443,
153-
}
154-
return
155-
}
156-
if c.CaddyConfig.Port == 0 {
157-
c.CaddyConfig.Port = 443
158-
}
159-
if c.CaddyConfig.Host == "" {
160-
c.CaddyConfig.Host = fmt.Sprintf("https://localhost:%d", c.CaddyConfig.Port)
161-
}
162-
}
163-
164136
func configureLogLevel(ll string) {
165137
level, err := zerolog.ParseLevel(ll)
166138
if err != nil {
@@ -221,7 +193,7 @@ func readJWTSecretKeyFromPath(keyPath string) string {
221193
}
222194

223195
func (c *Config) setDefaultAuthConfig() {
224-
defaultJWTSecretKeyPath := "/opt/gemfast/etc/gemfast/.jwt_secret_key"
196+
defaultJWTSecretKeyPath := ".jwt_secret_key"
225197
if c.Auth == nil {
226198
c.Auth = &AuthConfig{
227199
Type: "local",
@@ -272,14 +244,14 @@ func (c *Config) setDefaultCVEConfig() {
272244
c.CVE = &CVEConfig{
273245
Enabled: false,
274246
MaxSeverity: "high",
275-
RubyAdvisoryDBDir: "/opt/gemfast/share/ruby-advisory-db",
247+
RubyAdvisoryDBDir: "ruby-advisory-db",
276248
}
277249
return
278250
}
279251
if c.CVE.MaxSeverity == "" {
280252
c.CVE.MaxSeverity = "high"
281253
}
282254
if c.CVE.RubyAdvisoryDBDir == "" {
283-
c.CVE.RubyAdvisoryDBDir = "/opt/gemfast/share/ruby-advisory-db"
255+
c.CVE.RubyAdvisoryDBDir = "ruby-advisory-db"
284256
}
285257
}

0 commit comments

Comments
 (0)