~petersanchez/gohome

90aadab392f5ac163c896c08f7cae8353fdbac84 — Peter Sanchez 10 months ago 79933ff
Added LICENSE and README files
3 files changed, 146 insertions(+), 17 deletions(-)

A LICENSE
A README.md
M config.example.ini
A LICENSE => LICENSE +32 -0
@@ 0,0 1,32 @@
Copyright (c) 2023, Peter Sanchez (pjs@petersanchez.com)
All rights reserved.

Redistribution and use in source and binary forms, with or 
without modification, are permitted provided that the 
following conditions are met:

 * Redistributions of source code must retain the above 
   copyright notice, this list of conditions and the 
   following disclaimer.

 * Redistributions in binary form must reproduce the above 
   copyright notice, this list of conditions and the following 
   disclaimer in the documentation and/or other materials 
   provided with the distribution.

 * Neither the name of Peter Sanchez nor the names of its 
   contributors may be used to endorse or promote products 
   derived from this software without specific prior written 
   permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

A README.md => README.md +112 -0
@@ 0,0 1,112 @@
GoHome
----

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

Example: `yourdomain.com/x/your-module`

## Why?

I got annoyed with my nginx hacks 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][issues] - [Mailing List][pinbox] -
[Contributing](#contributing)

[issues]: https://todo.code.netlandish.com/~petersanchez/gohome
[pinbox]: https://lists.code.netlandish.com/~petersanchez/public-inbox

## 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.

## Contributing

We accept patches [submitted via email][gitemail] 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][cdoc] 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/gohome@lists.code.netlandish.com"

    $ git config format.subjectPrefix "PATCH gohome"

We have more information on the topic here:

- [Contributing][cdoc]
- [Using email with Git][gitemail]
- [Mailing list etiquette][etiquette]

[etiquette]: https://man.code.netlandish.com/lists/etiquette.md
[gitemail]: https://man.code.netlandish.com/git/email.md
[cdoc]: https://man.code.netlandish.com/contributing.md

## Copyright & Warranty

All documentation, libraries, and sample code are Copyright 2023
Peter Sanchez. &lt;<pjs@petersanchez.com>&gt;. 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>.

M config.example.ini => config.example.ini +2 -17
@@ 1,22 1,17 @@
[gobwebs]
# What IP/Host and Port should the server listen on
listen-address = localhost
listen-port = 8000
environment=development

# Options: debug, normal
# Default is debug
server-mode=debug
server-mode=normal

# How to manage email.
# Options: console, smtp
# Default: console
email-service=console

# File storage
# Options: fs, s3
# Default: fs
storage-service=fs

# Admin email
admin-email=admin@yourdomain.com



@@ 27,9 22,6 @@ default-from-email=gohome@yourdomain.com
# Default: true
email-admin-errors=true

# Language
default-language=en

scheme=https
domain=yourdomain.com



@@ 37,13 29,6 @@ domain=yourdomain.com
# Path to sqlite3 db file
connection-string = /path/to/gohome.db

[storage]
# Section for file storage variables

# If storage service is fs, then set root-directory
# Defaults to: ./
root-directory=./

[gohome]
# Set to the value of the root URL path. Ie, if the repo URL is
# yourdomain.com/x/repo-name then the root value is 'x'. leave blank