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

View File

@ -1,33 +1,48 @@
GO=go GO=go
GOFLAGS=-mod=vendor GOFLAGS=-mod=vendor
BINPATH=/usr/local/bin PREFIX=/usr/local
DATAPATH=/var/bloat BINPATH=$(PREFIX)/bin
ETCPATH=/etc 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 $(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 install: bloat
mkdir -p $(BINPATH) $(SHAREPATH)/templates $(SHAREPATH)/static
cp bloat $(BINPATH)/bloat cp bloat $(BINPATH)/bloat
chmod 0755 $(BINPATH)/bloat chmod 0755 $(BINPATH)/bloat
mkdir -p $(DATAPATH)/database cp -r templates/* $(SHAREPATH)/templates
cp -r templates $(DATAPATH)/ chmod 0644 $(SHAREPATH)/templates/*
cp -r static $(DATAPATH)/ cp -r static/* $(SHAREPATH)/static
sed -e "s%=database%=$(DATAPATH)/database%g" \ chmod 0644 $(SHAREPATH)/static/*
-e "s%=templates%=$(DATAPATH)/templates%g" \
-e "s%=static%=$(DATAPATH)/static%g" \ tags: $(SRC)
< bloat.conf > $(ETCPATH)/bloat.conf gotags $(SRC) > tags
uninstall: uninstall:
rm -f $(BINPATH)/bloat rm -f $(BINPATH)/bloat
rm -fr $(DATAPATH)/templates rm -fr $(SHAREPATH)/templates
rm -fr $(DATAPATH)/static rm -fr $(SHAREPATH)/static
rm -f $(ETCPATH)/bloat.conf
clean: clean:
rm -f bloat rm -f bloat
rm -f bloat.def.conf
run: bloat
./bloat -f bloat.conf

2
README
View File

@ -21,7 +21,7 @@ $ ed bloat.conf
Run the binary Run the binary
$ ./bloat -f bloat.conf $ ./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. listen address. See the INSTALL file for more details.