diff options
| -rw-r--r-- | Makefile | 14 | ||||
| -rw-r--r-- | README.md | 54 |
2 files changed, 62 insertions, 6 deletions
@@ -15,16 +15,22 @@ runlocal: go build -ldflags "-X 'github.com/LMBishop/scrapbook/pkg/constants.SysConfDir=${PWD}/runlocal/config' -X 'github.com/LMBishop/scrapbook/pkg/constants.SysDataDir=${PWD}/runlocal/data'" -o runlocal/${BINARY_NAME} main.go cd runlocal; ./${BINARY_NAME} -install: build +.PHONY: install +install: install -Dm755 ${BINARY_NAME} /usr/local/bin/${BINARY_NAME} -installconf: +.PHONY: install-config +install-config: + install --backup -Dm755 dist/config.toml ${SYS_CONF_DIR}/config.toml + +.PHONY: install-service +install-service: install -Dm755 dist/scrapbook.service ${SYSTEMD_DIR}/ - install -Dm755 dist/config.toml ${SYS_CONF_DIR}/config.toml if ! getent passwd scrapbook > /dev/null; then \ useradd --system --create-home --shell /usr/sbin/nologin --home-dir ${SYS_DATA_DIR} scrapbook ;\ fi +.PHONY: clean clean: go clean - rm ${BINARY_NAME}
\ No newline at end of file + rm ${BINARY_NAME} @@ -9,8 +9,58 @@ if you wish to serve sites using another web server. It was originally built for me to use in conjunction with my own [static site generator](https://github.com/LMBishop/panulat) in a GitHub workflow. -## Example +## Installation +This program is designed to work on any Linux machine. There is a provided Makefile +with `install`, `install-config`, and `install-service` targets. To install the +program itself: + +```bash +make +make install +``` + +If this is the first installation, then you may also want to install the default +configuration with the `install-config` target. + +```bash +make install-config ``` -curl -X POST -H "Authorization: Bearer (token)" -F upload=@file.zip https://publish.example.com/api/site/:site/upload + +If you are on a systemd distribution, then there is also a provided service file which +the `install-service` target will install. This target will also create a `scrapbook` +user on the system. + +```bash +make install-service ``` + +## Configuration + +Scrapbook will look for its configuration in `/etc/scrapbook/` by default. You can +run the `install-config` target to install the provided [default configuration](https://github.com/LMBishop/scrapbook/blob/master/dist/config.toml). + +You must set a hostname and secret for the web management interface and API. (I +collectively call these the 'Command' interfaces, as it is the way you issue +commands to scrapbook.) + +```toml +[Command] +Host = '' +Secret = '' +``` + +If either values are left blank, then the web management interface and API will +be inaccessible. + +## Practical notes and recommended setup + +**TLS.** Scrapbook currently has no support for TLS. I would recommend running it +behind a reverse proxy (I use nginx) and terminating TLS connections there before +passing them to scrapbook. + +**Certificates / DNS.** On the topic of certificates, I would recommend getting a +wildcard certificate for the (sub-)domain you want to serve scrapbook sites with. +Couple this with a wildcard CNAME pointing to your webserver, and you can very +easily set up a new sites on different subdomains all within the scrapbook web +management interface. |
