Update makefile and install instructions

Updated makefile now performs installation without overwriting config
and database directory.
This commit is contained in:
r 2020-02-18 21:48:21 +00:00
parent d028eb5077
commit 39a3bb7f35
3 changed files with 62 additions and 60 deletions

69
INSTALL
View File

@ -1,62 +1,49 @@
Installation
Commands starting with # are to be is to run as root.
1. Get the sources
1. Get the source
Get the source code by running
$ git clone https://git.freesoftwareextremist.com/bloat
You can also download the latest source tarball from the URL
"https://git.freesoftwareextremist.com/bloat/snapshot/bloat-master.tar.gz"
2. Build and install
Install GO from your system's package manager or from https://golang.org/dl,
then run make to compile the source.
Install GO from your system's package manager or from https://golang.org/dl.
Then run make to compile the source.
$ make
# make install
This will perform a system wide installation of bloat. By default, it will
install the binary in /usr/local/bin, data files in /var/bloat and config
file in /etc. You can change these paths by editing the Makefile.
install the binary in /usr/local/bin and data files in /usr/local/share/bloat.
You can change these paths by editing the Makefile.
3. Edit the config file
Comments in the config file describe what each config value does. For most
cases, you only need to change the value of "client_website".
# $EDITOR /etc/bloat.conf
3. Edit and copy the config file
Edit the generated config file to you liking and then copy it to the default
config location. Comments in the config file describe what each config value
does. For most cases, you only need to change the value of "client_website".
$ $EDITOR bloat.def.conf
# cp bloat.def.conf /etc/bloat.conf
4. Create a separate user account to run bloat
It's not required to create a separate user account, but it's a good practice
to do so.
4. Create database directory
Create a directory to store session information. Optionally, create a user
to run bloat and change the ownership of the database directory accordingly.
# mkdir /var/bloat
# useradd _bloat
# chown -R _bloat:_bloat /var/bloat
Replace /var/bloat with the value you specified in the Makefile.
Replace /var/bloat with the value you specified in the config file.
5. Run the binary
# su _bloat -c bloat
Now you should create an init script to automatically start the service at
system startup.
Now you should create an init script to automatically start bloat at system
startup.
6. Setup TLS
You can use an HTTP server as a reverse proxy to serve bloat over HTTPS. Here's
a config file snippet for nginx:
`
server {
server_name bloat.example.com;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
server {
server_name bloat.example.com;
listen 443 ssl;
ssl_trusted_certificate /etc/ssl/example.com.crt;
ssl_certificate /etc/ssl/example.com.fullchain.pem;
ssl_certificate_key /etc/ssl/private/example.com.key;
Update
location / {
proxy_pass http://127.0.0.1:8080;
}
}
`
This configuration accepts for connections for bloat.example.com (specified by
"client_website" in config) over both HTTP and HTTPS and forwards them to
bloat's listen address (specified by "listen_address" in config).
Either run git pull to fetch the updated source or download the latest tarball
from the URL mentioned in the installation step. Then run make to install the
updated binary and data files
$ git pull
$ make
# make install
Note: Commands starting with # are to be is to run as root.

View File

@ -1,33 +1,48 @@
GO=go
GOFLAGS=-mod=vendor
BINPATH=/usr/local/bin
DATAPATH=/var/bloat
ETCPATH=/etc
PREFIX=/usr/local
BINPATH=$(PREFIX)/bin
SHAREPATH=$(PREFIX)/share/bloat
all: bloat
TMPL=templates/*.tmpl
SRC=main.go \
config/*.go \
kv/*.go \
mastodon/*.go \
model/*.go \
renderer/*.go \
repo/*.go \
service/*.go \
util/*.go \
bloat: main.go
all: bloat bloat.def.conf
bloat: $(SRC) $(TMPL)
$(GO) build $(GOFLAGS) -o bloat main.go
bloat.def.conf:
sed -e "s%=database%=/var/bloat%g" \
-e "s%=templates%=$(SHAREPATH)/templates%g" \
-e "s%=static%=$(SHAREPATH)/static%g" \
< bloat.conf > bloat.def.conf
install: bloat
mkdir -p $(BINPATH) $(SHAREPATH)/templates $(SHAREPATH)/static
cp bloat $(BINPATH)/bloat
chmod 0755 $(BINPATH)/bloat
mkdir -p $(DATAPATH)/database
cp -r templates $(DATAPATH)/
cp -r static $(DATAPATH)/
sed -e "s%=database%=$(DATAPATH)/database%g" \
-e "s%=templates%=$(DATAPATH)/templates%g" \
-e "s%=static%=$(DATAPATH)/static%g" \
< bloat.conf > $(ETCPATH)/bloat.conf
cp -r templates/* $(SHAREPATH)/templates
chmod 0644 $(SHAREPATH)/templates/*
cp -r static/* $(SHAREPATH)/static
chmod 0644 $(SHAREPATH)/static/*
tags: $(SRC)
gotags $(SRC) > tags
uninstall:
rm -f $(BINPATH)/bloat
rm -fr $(DATAPATH)/templates
rm -fr $(DATAPATH)/static
rm -f $(ETCPATH)/bloat.conf
rm -fr $(SHAREPATH)/templates
rm -fr $(SHAREPATH)/static
clean:
rm -f bloat
run: bloat
./bloat -f bloat.conf
rm -f bloat.def.conf

2
README
View File

@ -21,7 +21,7 @@ $ ed bloat.conf
Run the binary
$ ./bloat -f bloat.conf
You can now access the frontend at http://localhost:8080, which is the default
You can now access the frontend at http://127.0.0.1:8080, which is the default
listen address. See the INSTALL file for more details.