Skip to content

Commit

Permalink
Install and configure Redis
Browse files Browse the repository at this point in the history
Redis privides server side caching.

Also, make Caddy the last service the script starts.
  • Loading branch information
basilhendroff committed Oct 4, 2020
1 parent 37f4d52 commit fca8973
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions wordpress-jail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ cat <<__EOF__ >/tmp/pkg.json
"php74-filter","php74-gd","php74-iconv","php74-pecl-mcrypt","php74-simplexml","php74-xmlreader","php74-zlib",
"php74-ftp","php74-pecl-ssh2","php74-sockets",
"mariadb103-server","unix2dos","ssmtp","phpmyadmin5-php74",
"php74-xmlrpc","php74-ctype","php74-session","php74-xmlwriter"
"php74-xmlrpc","php74-ctype","php74-session","php74-xmlwriter",
"redis","php74-pecl-redis"
]
}
__EOF__
Expand Down Expand Up @@ -220,18 +221,6 @@ print_msg "Enable phpMyAdmin..."
iocage exec "${JAIL_NAME}" rm /usr/local/www/phpMyAdmin/config.inc.php
iocage exec "${JAIL_NAME}" ln -s /usr/local/www/phpMyAdmin /usr/local/www/wordpress/phpmyadmin

#####################################################################
print_msg "Configure and start Caddy..."

# Copy and edit pre-written config files
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile /usr/local/www
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/caddy /usr/local/etc/rc.d/

iocage exec "${JAIL_NAME}" sysrc caddy_enable="YES"
iocage exec "${JAIL_NAME}" sysrc caddy_config="/usr/local/www/Caddyfile"

iocage exec "${JAIL_NAME}" service caddy start

#####################################################################
print_msg "Configure and start PHP-FPM..."

Expand Down Expand Up @@ -272,6 +261,19 @@ iocage exec "${JAIL_NAME}" sed -i '' "s|database_name_here|wordpress|" /usr/loca
iocage exec "${JAIL_NAME}" sed -i '' "s|username_here|wordpress|" /usr/local/www/wordpress/wp-config.php
iocage exec "${JAIL_NAME}" sed -i '' "s|password_here|${DB_PASSWORD}|" /usr/local/www/wordpress/wp-config.php

##################################################################### ???
print_msg "Configure and start REDIS..."

# Edit pre-written config files
iocage exec "${JAIL_NAME}" sed -i '' "s|port 6379|port 0|" /usr/local/etc/redis.conf
iocage exec "${JAIL_NAME}" sed -i '' "s|# unixsocket /tmp/redis.sock|unixsocket /var/run/redis/redis.sock|" /usr/local/etc/redis.conf
iocage exec "${JAIL_NAME}" sed -i '' "s|# unixsocketperm 700|unixsocketperm 770|" /usr/local/etc/redis.conf

iocage exec "${JAIL_NAME}" sysrc redis_enable="YES"
iocage exec "${JAIL_NAME}" service redis start

iocage exec "${JAIL_NAME}" pw usermod www -G redis

#####################################################################
print_msg "Configure sSMTP..."

Expand All @@ -285,6 +287,18 @@ iocage exec "${JAIL_NAME}" chmod 640 /usr/local/etc/ssmtp/ssmtp.conf
iocage exec "${JAIL_NAME}" chown ssmtp:nogroup /usr/local/sbin/ssmtp
iocage exec "${JAIL_NAME}" chmod 4555 /usr/local/sbin/ssmtp

#####################################################################
print_msg "Configure and start Caddy..."

# Copy and edit pre-written config files
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile /usr/local/www
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/caddy /usr/local/etc/rc.d/

iocage exec "${JAIL_NAME}" sysrc caddy_enable="YES"
iocage exec "${JAIL_NAME}" sysrc caddy_config="/usr/local/www/Caddyfile"

iocage exec "${JAIL_NAME}" service caddy start

#####################################################################
print_msg "Installation complete!"

Expand Down

0 comments on commit fca8973

Please sign in to comment.