Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions deploy/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,22 +354,6 @@ function db_user_postgresql() {
sudo su - "$__pguser" -c "$__psql -d $__pgdb -c '$_dbstatementgrant'"
}

# Create empty DB and import schema
# string PostgreSQL_db_name
# string PostgreSQL_system_user
# string PostgreSQL_db_schema_file
# string PostgreSQL_db_user
function schema_postgresql() {
local __psql="/usr/lib/postgresql/10/bin/psql"
local __pgdb=$1
local __pguser=$2
local __pgschema=$3
local __dbuser=$4

log "Importing schema $__pgschema"
sudo su - "$__pguser" -c "$__psql -U $__dbuser -d $__pgdb -f $__pgschema"
}

# Configure PostgreSQL
# string postgres_conf_file_location
# string postgres_service_name
Expand Down Expand Up @@ -402,6 +386,11 @@ function configure_redis() {

cat "$__conf" | sed "s|REDIS_PASSWORD|$__password|g" | sudo tee "$__redis"

# For some reason in Ubuntu 20.04 redis does not communicate with systemd, this will fix it
local _systemd_redis="/lib/systemd/system/redis-server.service"
cat "$_systemd_redis" | sed "s|Type=forking|Type=notify|g" | sudo tee "$_systemd_redis"

sudo systemctl daemon-reload
sudo systemctl restart "$__service"
sudo systemctl enable "$__service"
}
Expand Down Expand Up @@ -429,11 +418,11 @@ function set_motd_centos() {
echo "$__centosmotd" | sudo tee -a /etc/profile
}

# Install go 1.15 from tgz
function install_go_15() {
local __version="1.15.6"
# Install go 1.18 from tgz
function install_go_18() {
local __version="1.18"
local __file="go$__version.linux-amd64.tar.gz"
local __url="https://dl.google.com/go/$__file"
local __url="https://go.dev/dl/$__file"
if ! [[ -d "/usr/local/go" ]]; then
log "Installing Golang $__version"
sudo curl -sO "$__url"
Expand Down
12 changes: 4 additions & 8 deletions deploy/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ package rsync
# Golang
# package golang-go
if ! [ -x "$(command -v go)" ]; then
install_go_15
install_go_18
fi

# Upgrade service
Expand Down Expand Up @@ -619,13 +619,8 @@ else
POSTGRES_HBA="/etc/postgresql/12/main/pg_hba.conf"
POSTGRES_PSQL="/usr/lib/postgresql/12/bin/psql"
elif [[ "$DISTRO" == "centos" ]]; then
sudo rpm -Uvh "http://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm"
package postgresql96-server
package postgresql96-contrib
sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
POSTGRES_SERVICE="postgresql-9.6"
POSTGRES_HBA="/var/lib/pgsql/9.6/data/pg_hba.conf"
POSTGRES_PSQL="/usr/pgsql-9.6/bin/psql"
log "For CentOS, please install Postgres > 12 manually"
exit $OHNOES
fi
configure_postgres "$POSTGRES_CONF" "$POSTGRES_SERVICE" "$POSTGRES_HBA"
db_user_postgresql "$_DB_NAME" "$_DB_SYSTEM_USER" "$_DB_USER" "$_DB_PASS" "$POSTGRES_PSQL"
Expand Down Expand Up @@ -655,6 +650,7 @@ else
configure_grafana
elif [[ "$DISTRO" == "centos" ]]; then
log "Not ready yet to install metrics for CentOS"
exit $OHNOES
fi
fi

Expand Down
2 changes: 2 additions & 0 deletions deploy/redis/redis.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
bind 127.0.0.1
daemonize no
supervised systemd
requirepass REDIS_PASSWORD