happyDomain/README.md

147 lines
3.7 KiB
Markdown
Raw Normal View History

2021-12-31 14:52:15 +00:00
happyDomain
===========
2020-07-28 15:34:55 +00:00
Finally a simple, modern and open source interface for domain name.
It consists of a HTTP REST API written in Golang (primarily based on https://github.com/miekg/dns) with a nice web interface written in Vue.js.
It runs as a single stateless Linux binary, backed by a database (currently: LevelDB, more to come soon).
2020-07-28 15:34:55 +00:00
Features
--------
TODO
Building
--------
2020-09-10 07:44:16 +00:00
### Dependencies
2020-07-28 15:34:55 +00:00
2021-12-31 14:52:15 +00:00
In order to build the happyDomain project, you'll need the following dependencies:
2020-07-28 15:34:55 +00:00
2021-10-19 22:02:48 +00:00
* `go` at least version 1.16
2020-07-28 15:34:55 +00:00
* `nodejs` tested with version 14.4.0
* `yarn` tested with version 1.22.4
### Instructions
1. First, you'll need to prepare the frontend, by installing the node modules dependencies:
2020-07-28 15:34:55 +00:00
```
2021-10-19 22:02:48 +00:00
yarn --cwd ui install
2020-07-28 15:34:55 +00:00
```
2. Then, generates assets files used by Go code:
2020-07-28 15:34:55 +00:00
```
2022-01-10 13:06:19 +00:00
go generate git.happydomain.org/happydomain/ui
go generate git.happydomain.org/happydomain
2020-07-28 15:34:55 +00:00
```
3. Finaly, build the Go code:
2020-07-28 15:34:55 +00:00
```
go build -v
2020-07-28 15:34:55 +00:00
```
2022-01-10 13:06:19 +00:00
This last command will create a binary `happydomain` you can use standalone.
2020-07-28 15:34:55 +00:00
Install at home
---------------
The binary comes with sane default options to start with.
You can simply launch the following command in your terminal:
```
2022-01-10 13:06:19 +00:00
./happydomain
2020-07-28 15:34:55 +00:00
```
After some initializations, it should show you:
2020-07-28 15:34:55 +00:00
2022-01-10 13:06:19 +00:00
Admin listening on ./happydomain.sock
2020-07-28 15:34:55 +00:00
Ready, listening on :8081
2021-12-31 14:52:15 +00:00
Go to http://localhost:8081/ to start using happyDomain.
2020-07-28 15:34:55 +00:00
### Database configuration
By default, the LevelDB storage engine is used. You can change the storage engine using the option `-storage-engine other-engine`.
2022-01-10 13:06:19 +00:00
The help command `./happydomain -help` can show you the available engines. By example:
2020-07-28 15:34:55 +00:00
-storage-engine value
Select the storage engine between [leveldb mysql] (default leveldb)
#### LevelDB
LevelDB is a small embedded key-value store (as SQLite it doesn't require an additional daemon to work).
2020-07-28 15:34:55 +00:00
-leveldb-path string
2022-01-10 13:06:19 +00:00
Path to the LevelDB Database (default "happydomain.db")
2020-07-28 15:34:55 +00:00
2022-01-10 13:06:19 +00:00
By default, a new directory is created near the binary, called `happydomain.db`. This directory contains the database used by the program.
You can change it to a more meaningful/persistant path.
2020-07-28 15:34:55 +00:00
### Persistant configuration
The binary will automatically look for some existing configuration files:
2022-01-10 13:06:19 +00:00
* `./happydomain.conf` in the current directory;
* `$XDG_CONFIG_HOME/happydomain/happydomain.conf`;
* `/etc/happydomain.conf`.
2020-07-28 15:34:55 +00:00
Only the first file found will be used.
It is also possible to specify a custom path by adding it as argument to the command line:
```
2022-01-10 13:06:19 +00:00
./happydomain /etc/happydomain/config
2020-07-28 15:34:55 +00:00
```
#### Config file format
Comments line has to begin with #, it is not possible to have comments at the end of a line, by appending # followed by a comment.
Place on each line the name of the config option and the expected value, separated by `=`. For example:
```
storage-engine=leveldb
2022-01-10 13:06:19 +00:00
leveldb-path=/var/lib/happydomain/db/
2020-07-28 15:34:55 +00:00
```
#### Environment variables
2022-01-10 13:06:19 +00:00
It'll also look for special environment variables, beginning with `HAPPYDOMAIN_`.
2020-07-28 15:34:55 +00:00
You can achieve the same as the previous example, with the following environment variables:
```
2022-01-10 13:06:19 +00:00
HAPPYDOMAIN_STORAGE_ENGINE=leveldb
HAPPYDOMAIN_LEVELDB_PATH=/var/lib/happydomain/db/
2020-07-28 15:34:55 +00:00
```
You just have to replace dash by underscore.
Development environment
-----------------------
If you want to contribute to the frontend, instead of regenerating the frontend assets each time you made a modification (with `go generate`), you can use the development tools:
2022-01-10 13:06:19 +00:00
In one terminal, run `happydomain` with the following arguments:
2020-07-28 15:34:55 +00:00
```
2022-01-10 13:06:19 +00:00
./happydomain -dev http://127.0.0.1:8080
2020-07-28 15:34:55 +00:00
```
In another terminal, run the node part:
```
2021-10-19 22:02:48 +00:00
yarn --cwd ui run serve
2020-07-28 15:34:55 +00:00
```
With this setup, static assets integrated inside the go binary will not be used, instead it'll forward all requests for static assets to the node server, that do dynamic reload, etc.