Skip to content

Commit

Permalink
Merge pull request #145 from joglomedia/2.x.x
Browse files Browse the repository at this point in the history
Add Postgres installer
  • Loading branch information
joglomedia authored Apr 8, 2023
2 parents 4dc2693 + d363b2c commit aeb3db0
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 108 deletions.
10 changes: 10 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ MARIABACKUP_USER="lemperdb"
# Leave it blank for auto generated secure password.
MARIABACKUP_PASS=""

[postgres]
INSTALL_POSTGRES=false

# Postgres version (only type the major version number).
POSTGRES_VERSION="15"

# Default Postgres system user.
POSTGRES_USER="postgres"
POSTGRES_PGDATA="/var/lib/postgresql/data"

[memcached]
INSTALL_MEMCACHED=false

Expand Down
70 changes: 40 additions & 30 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ fi

### Create default account ###
echo ""
USERNAME=${LEMPER_USERNAME:-"lemper"}
create_account "${USERNAME}"
LEMPER_USERNAME=${LEMPER_USERNAME:-"lemper"}
create_account "${LEMPER_USERNAME}"

### Certbot Let's Encrypt SSL installation ###
if [ -f ./scripts/install_certbotle.sh ]; then
Expand Down Expand Up @@ -192,46 +192,49 @@ if [[ "${DRYRUN}" != true ]]; then
status -e "\nCongrats, your LEMPer Stack installation has been completed."

### Recap ###
if [[ -n "${PASSWORD}" ]]; then
if [[ -n "${LEMPER_PASSWORD}" ]]; then
CREDENTIALS="~~~~~~~~~~~~~~~~~~~~~~~~~o0o~~~~~~~~~~~~~~~~~~~~~~~~~
Default system information:
Hostname : ${HOSTNAME}
Server IP: ${SERVER_IP}
SSH Port : ${SSH_PORT}
LEMPer Stack admin account:
Username : ${USERNAME}
Password : ${PASSWORD}
Username : ${LEMPER_USERNAME}
Password : ${LEMPER_PASSWORD}
Database administration (Adminer):
http://${SERVER_IP}:8082/lcp/dbadmin/
Database root password: ${MYSQL_ROOT_PASSWORD}
MySQL root password: ${MYSQL_ROOT_PASSWORD}
Mariabackup user information:
DB Username: ${MARIABACKUP_USER}
DB Password: ${MARIABACKUP_PASS}
DB Password: ${MARIABACKUP_PASS}"

File manager (TinyFileManager):
http://${SERVER_IP}:8082/lcp/filemanager/
if [[ "${INSTALL_POSTGRES}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Use your default LEMPer stack admin account for Filemanager login."
PostgreSQL user information:
Default Postgres User: ${POSTGRES_USER}
if [[ "${INSTALL_MAILER}" == true ]]; then
PostgresSQL DB Username: ${PSQL_USER}
PostgresSQL DB Password: ${PSQL_PASS}"
fi

if [[ "${INSTALL_MONGODB}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Default Mail service:
Maildir : /home/${USERNAME}/Maildir
Sender Domain: ${SENDER_DOMAIN}
Sender IP : ${SERVER_IP}
IMAP Port : 143, 993 (SSL/TLS)
POP3 Port : 110, 995 (SSL/TLS)
MongoDB test admin login:
Username : ${MONGODB_ADMIN_USER}
Password : ${MONGODB_ADMIN_PASSWORD}"
fi

Domain Key : lemper._domainkey.${SENDER_DOMAIN}
DKIM Key : ${DKIM_KEY}
SPF Record : v=spf1 ip4:${SERVER_IP} include:${SENDER_DOMAIN} mx ~all
if [[ "${INSTALL_REDIS}" == true && "${REDIS_REQUIRE_PASSWORD}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Use your default LEMPer stack admin account for Mail login."
Redis required password enabled:
Password : ${REDIS_PASSWORD}"
fi

if [[ "${INSTALL_MEMCACHED}" == true && "${MEMCACHED_SASL}" == true ]]; then
Expand All @@ -242,23 +245,30 @@ Memcached SASL login:
Password : ${MEMCACHED_PASSWORD}"
fi

if [[ "${INSTALL_MONGODB}" == true ]]; then
if [[ "${INSTALL_MAILER}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
MongoDB test admin login:
Username : ${MONGODB_ADMIN_USER}
Password : ${MONGODB_ADMIN_PASSWORD}"
fi
Default Mail service:
Maildir : /home/${LEMPER_USERNAME}/Maildir
Sender Domain: ${SENDER_DOMAIN}
Sender IP : ${SERVER_IP}
IMAP Port : 143, 993 (SSL/TLS)
POP3 Port : 110, 995 (SSL/TLS)
if [[ "${INSTALL_REDIS}" == true && "${REDIS_REQUIRE_PASSWORD}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Domain Key : lemper._domainkey.${SENDER_DOMAIN}
DKIM Key : ${DKIM_KEY}
SPF Record : v=spf1 ip4:${SERVER_IP} include:${SENDER_DOMAIN} mx ~all
Redis required password enabled:
Password : ${REDIS_PASSWORD}"
Use your default LEMPer stack admin account for Mail login."
fi

CREDENTIALS="${CREDENTIALS}
File manager (TinyFileManager):
http://${SERVER_IP}:8082/lcp/filemanager/
Use your default LEMPer stack admin account for Filemanager login.
Please Save the above Credentials & Keep it Secure!
~~~~~~~~~~~~~~~~~~~~~~~~~o0o~~~~~~~~~~~~~~~~~~~~~~~~~"

Expand Down
80 changes: 45 additions & 35 deletions lemper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function lemper_install() {

### Create default account ###
echo ""
USERNAME=${LEMPER_USERNAME:-"lemper"}
create_account "${USERNAME}"
LEMPER_USERNAME=${LEMPER_USERNAME:-"lemper"}
create_account "${LEMPER_USERNAME}"

### Certbot Let's Encrypt SSL installation ###
if [ -f ./scripts/install_certbotle.sh ]; then
Expand Down Expand Up @@ -188,46 +188,49 @@ function lemper_install() {
status -e "\nCongrats, your LEMPer Stack installation has been completed."

### Recap ###
if [[ -n "${PASSWORD}" ]]; then
if [[ -n "${LEMPER_PASSWORD}" ]]; then
CREDENTIALS="~~~~~~~~~~~~~~~~~~~~~~~~~o0o~~~~~~~~~~~~~~~~~~~~~~~~~
Default System Information:
Hostname : ${HOSTNAME}
Server IP: ${SERVER_IP}
SSH Port : ${SSH_PORT}
Hostname : ${HOSTNAME}
Server IP: ${SERVER_IP}
SSH Port : ${SSH_PORT}
LEMPer Stack Admin Account:
Username : ${USERNAME}
Password : ${PASSWORD}
Username : ${LEMPER_USERNAME}
Password : ${LEMPER_PASSWORD}
Database Administration (Adminer):
http://${SERVER_IP}:8082/lcp/dbadmin/
http://${SERVER_IP}:8082/lcp/dbadmin/
Database root password: ${MYSQL_ROOT_PASSWORD}
MySQL root password: ${MYSQL_ROOT_PASSWORD}
Mariabackup Information:
Mariabackup user information:
DB Username: ${MARIABACKUP_USER}
DB Password: ${MARIABACKUP_PASS}
DB Password: ${MARIABACKUP_PASS}"

Simple File Manager (Experimental):
http://${SERVER_IP}:8082/lcp/filemanager/
if [[ "${INSTALL_POSTGRES}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Use your default LEMPer Stack admin account for Filemanager login."
PostgreSQL user information:
Default Postgres User: ${POSTGRES_USER}
if [[ "${INSTALL_MAILER}" == true ]]; then
PostgresSQL DB Username: ${PSQL_USER}
PostgresSQL DB Password: ${PSQL_PASS}"
fi

if [[ "${INSTALL_MONGODB}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Default Mail Service:
Maildir : /home/${USERNAME}/Maildir
Sender Domain: ${SENDER_DOMAIN}
Sender IP : ${SERVER_IP}
IMAP Port : 143, 993 (SSL/TLS)
POP3 Port : 110, 995 (SSL/TLS)
MongoDB Test Admin Login:
Username : ${MONGODB_ADMIN_USER}
Password : ${MONGODB_ADMIN_PASSWORD}"
fi

Domain Key : lemper._domainkey.${SENDER_DOMAIN}
DKIM Key : ${DKIM_KEY}
SPF Record : v=spf1 ip4:${SERVER_IP} include:${SENDER_DOMAIN} mx ~all
if [[ "${INSTALL_REDIS}" == true && "${REDIS_REQUIRE_PASSWORD}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Use your default LEMPer Stack admin account for Mail login."
Redis required password enabled:
Password : ${REDIS_PASSWORD}"
fi

if [[ "${INSTALL_MEMCACHED}" == true && "${MEMCACHED_SASL}" == true ]]; then
Expand All @@ -238,23 +241,30 @@ Memcached SASL Login:
Password : ${MEMCACHED_PASSWORD}"
fi

if [[ "${INSTALL_MONGODB}" == true ]]; then
if [[ "${INSTALL_MAILER}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
MongoDB Test Admin Login:
Username : ${MONGODB_ADMIN_USER}
Password : ${MONGODB_ADMIN_PASSWORD}"
fi
Default Mail Service:
Maildir : /home/${LEMPER_USERNAME}/Maildir
Sender Domain: ${SENDER_DOMAIN}
Sender IP : ${SERVER_IP}
IMAP Port : 143, 993 (SSL/TLS)
POP3 Port : 110, 995 (SSL/TLS)
if [[ "${INSTALL_REDIS}" == true && "${REDIS_REQUIRE_PASSWORD}" == true ]]; then
CREDENTIALS="${CREDENTIALS}
Domain Key : lemper._domainkey.${SENDER_DOMAIN}
DKIM Key : ${DKIM_KEY}
SPF Record : v=spf1 ip4:${SERVER_IP} include:${SENDER_DOMAIN} mx ~all
Redis required password enabled:
Password : ${REDIS_PASSWORD}"
Use your default LEMPer Stack admin account for Mail login."
fi

CREDENTIALS="${CREDENTIALS}
File manager (TinyFileManager):
http://${SERVER_IP}:8082/lcp/filemanager/
Use your default LEMPer stack admin account for Filemanager login.
Please Save the above Credentials & Keep it Secure!
~~~~~~~~~~~~~~~~~~~~~~~~~o0o~~~~~~~~~~~~~~~~~~~~~~~~~"

Expand Down
4 changes: 2 additions & 2 deletions scripts/install_memcached.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ function init_memcached_install() {
echo "Memcached SASL auth option is enabled..."

if [[ "${DRYRUN}" != true ]]; then
MEMCACHED_USERNAME=${MEMCACHED_USERNAME:-"lempermc"}
MEMCACHED_PASSWORD=${MEMCACHED_PASSWORD:-$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)}
export MEMCACHED_USERNAME=${MEMCACHED_USERNAME:-"lempermc"}
export MEMCACHED_PASSWORD=${MEMCACHED_PASSWORD:-$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)}

run mkdir -p /etc/sasl2 && run touch /etc/sasl2/memcached_memcache.conf
cat > /etc/sasl2/memcached_memcache.conf <<EOL
Expand Down
4 changes: 2 additions & 2 deletions scripts/install_mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ function init_mongodb_install() {

sleep 3 # Wait for MongoDB to completely started.

MONGODB_ADMIN_USER=${MONGODB_ADMIN_USER:-"lemperdb"}
MONGODB_ADMIN_PASSWORD=${MONGODB_ADMIN_PASSWORD:-"$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"}
export MONGODB_ADMIN_USER=${MONGODB_ADMIN_USER:-"lemperdb"}
export MONGODB_ADMIN_PASSWORD=${MONGODB_ADMIN_PASSWORD:-"$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"}

run mongosh admin \
--eval "\"db.createUser({'user': '${MONGODB_ADMIN_USER}', 'pwd': '${MONGODB_ADMIN_PASSWORD}', 'roles':[{'role': 'root', 'db': 'admin'}]});\""
Expand Down
Loading

0 comments on commit aeb3db0

Please sign in to comment.