~petersanchez/gohome

A simple app that let's you self host your Go modules using your own domains
4 months ago
4 months ago

#GoHome

A simple app that lets you self host your Go modules using your own domains.

Example: yourdomain.com/x/your-module

#Why?

I got annoyed with the nginx hacks I previously used as they kept getting longer and longer to support some modules.

Then I moved some projects from Mercurial to Git and had to update various projects for the new path. This was also very annoying.

I looked for something to solve this issue for me but I didn't find anything that scratched my itch. So I just wrote the solution I wanted.

#Details

Project Links: Issues - Mailing List - Contributing

#Requirements

  • It was written for Go 1.20+
  • sqlite3
  • GNU Make

#Installation

$ git clone https://git.code.netlandish.com/~petersanchez/gohome
$ cd gohome
$ make  # (or gmake)
$ cp config.example.ini config.ini
$ vim config.ini  # use your favorite editor
$ ./gohome migrate
$ ./gohome

Now load your install in a web browser. For instance, if this is on a local development machine the defaults in config.example.ini are http://127.0.0.1:8000/x/--admin--

You'll be asked to set the default password. This is needed when adding/editing modules to the database. Once set you'll be asked to login, enter the same password you just set.

Now just click the Add button and add your modules.

If you're installing this behind a reverse proxy (ie, nginx) you'll need to add the configuration for the path you're using. Here's an example from my nginx config for a domain I have this running on:

location /x/ {
    proxy_pass http://127.0.0.1:6001;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

#Configuration

The config.example.ini is pretty straight forward with comments to help. Really just change the connection-string and root variables and that's probably the only thing you need to change.

#Screenshots

Manage area - Module listing

Module listing

Manage area - Module Add / Edit

Module Add / Edit

Public Module Page (ie, yourdomain.com/x/module)

Public Module Page

#Contributing

We accept patches submitted via email to our mailing list. For an easy and quick tutorial on how to do this, see https://git-send-email.io

Please see our contributing document for more information.

The mailing list where you submit your patches is ~petersanchez/public-inbox@lists.code.netlandish.com. You can also view the archives on the web here:

https://lists.code.netlandish.com/~petersanchez/public-inbox

To quickly setup your clone of gohome to submit to the mailing list run the following commands:

$ git config sendemail.to "~petersanchez/public-inbox@lists.code.netlandish.com"

$ git config format.subjectPrefix "PATCH gohome"

We have more information on the topic here:

All documentation, libraries, and sample code are Copyright 2023 Peter Sanchez. <pjs@petersanchez.com>. The library and sample code are made available to you under the terms of the BSD license which is contained in the included file, LICENSE.

#Commercial Support

This software, and lots of other software like it, has been built in support of many of Netlandish's own projects, and the projects of our clients. We would love to help you on your next project so get in touch by dropping us a note at hello@netlandish.com.