forked from GithubBackups/vichan
Merge pull request #2 from AlexVeeBee/master
Update installer and cache config
This commit is contained in:
commit
64edc11a23
@ -53,7 +53,8 @@ MYSQL_PASSWORD=vichan!
|
|||||||
MYSQL_ROOT_PASSWORD=vichan!!
|
MYSQL_ROOT_PASSWORD=vichan!!
|
||||||
|
|
||||||
|
|
||||||
# Redis
|
# Cache Settings
|
||||||
VICHAN_REDIS_HOST=redis
|
VICHAN_CACHE_ENGINE=redis
|
||||||
VICHAN_REDIS_PORT=6379
|
VICHAN_CACHE_HOST=redis
|
||||||
VICHAN_REDIS_PASSWORD=redis!
|
VICHAN_CACHE_PORT=6379
|
||||||
|
VICHAN_CACHE_PASSWORD=redis!
|
||||||
|
|||||||
15
compose.yml
15
compose.yml
@ -39,10 +39,11 @@ services:
|
|||||||
VICHAN_MYSQL_PASSWORD: ${VICHAN_MYSQL_PASSWORD}
|
VICHAN_MYSQL_PASSWORD: ${VICHAN_MYSQL_PASSWORD}
|
||||||
# Security
|
# Security
|
||||||
VICHAN_SECURE_LOGIN_ONLY: ${VICHAN_SECURE_LOGIN_ONLY}
|
VICHAN_SECURE_LOGIN_ONLY: ${VICHAN_SECURE_LOGIN_ONLY}
|
||||||
# Redis settings
|
# Cache settings
|
||||||
VICHAN_REDIS_HOST: ${VICHAN_REDIS_HOST}
|
VICHAN_CACHE_ENGINE: ${VICHAN_CACHE_ENGINE}
|
||||||
VICHAN_REDIS_PORT: ${VICHAN_REDIS_PORT}
|
VICHAN_CACHE_HOST: ${VICHAN_CACHE_HOST}
|
||||||
VICHAN_REDIS_PASSWORD: ${VICHAN_REDIS_PASSWORD}
|
VICHAN_CACHE_PORT: ${VICHAN_CACHE_PORT}
|
||||||
|
VICHAN_CACHE_PASSWORD: ${VICHAN_CACHE_PASSWORD}
|
||||||
# Cookies
|
# Cookies
|
||||||
VICHAN_COOKIES_MOD: ${VICHAN_COOKIES_MOD}
|
VICHAN_COOKIES_MOD: ${VICHAN_COOKIES_MOD}
|
||||||
# Flood Control
|
# Flood Control
|
||||||
@ -88,10 +89,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./local-instances/${INSTANCE:-0}/redis:/data
|
- ./local-instances/${INSTANCE:-0}/redis:/data
|
||||||
environment:
|
environment:
|
||||||
REDIS_PASSWORD: ${VICHAN_REDIS_PASSWORD}
|
REDIS_PASSWORD: ${VICHAN_CACHE_PASSWORD}
|
||||||
command: redis-server --requirepass ${VICHAN_REDIS_PASSWORD}
|
command: redis-server --requirepass ${VICHAN_CACHE_PASSWORD}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "-a", "${VICHAN_REDIS_PASSWORD}", "ping"]
|
test: ["CMD", "redis-cli", "-a", "${VICHAN_CACHE_PASSWORD}", "ping"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
@ -47,7 +47,7 @@ RUN apk add --no-cache \
|
|||||||
&& pecl install -o -f igbinary \
|
&& pecl install -o -f igbinary \
|
||||||
&& pecl install redis \
|
&& pecl install redis \
|
||||||
&& pecl install imagick \
|
&& pecl install imagick \
|
||||||
$$ docker-php-ext-enable \
|
&& docker-php-ext-enable \
|
||||||
igbinary \
|
igbinary \
|
||||||
redis \
|
redis \
|
||||||
imagick \
|
imagick \
|
||||||
|
|||||||
@ -20,12 +20,22 @@ class Cache {
|
|||||||
$config['cache']['memcached']
|
$config['cache']['memcached']
|
||||||
);
|
);
|
||||||
case 'redis':
|
case 'redis':
|
||||||
|
$host = $config['cache']['redis'][0] ?? 'localhost';
|
||||||
|
$port = $config['cache']['redis'][1] ?? 6379;
|
||||||
|
$password = $config['cache']['redis'][2] ?? '';
|
||||||
|
$database = $config['cache']['redis'][3] ?? 1;
|
||||||
|
|
||||||
|
$host = getenv('VICHAN_CACHE_HOST') ?: $host;
|
||||||
|
$port = getenv('VICHAN_CACHE_PORT') ?: $port;
|
||||||
|
$password = getenv('VICHAN_CACHE_PASSWORD') ?: $password;
|
||||||
|
$database = getenv('VICHAN_CACHE_DATABASE') ?: $database;
|
||||||
|
|
||||||
return new RedisCacheDriver(
|
return new RedisCacheDriver(
|
||||||
$config['cache']['prefix'],
|
$config['cache']['prefix'],
|
||||||
$config['cache']['redis'][0],
|
$host,
|
||||||
$config['cache']['redis'][1],
|
$port,
|
||||||
$config['cache']['redis'][2],
|
$password,
|
||||||
$config['cache']['redis'][3]
|
$database
|
||||||
);
|
);
|
||||||
case 'apcu':
|
case 'apcu':
|
||||||
return new ApcuCacheDriver;
|
return new ApcuCacheDriver;
|
||||||
|
|||||||
@ -137,32 +137,16 @@
|
|||||||
* ====================
|
* ====================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Determine if Redis is configured via environment variables
|
|
||||||
$redis_enabled = getenv('VICHAN_REDIS_HOST') !== false && getenv('VICHAN_REDIS_PORT') !== false;
|
|
||||||
|
|
||||||
// Configure cache
|
|
||||||
if ($redis_enabled) {
|
|
||||||
$config['cache']['enabled'] = 'redis';
|
|
||||||
$config['cache']['redis'] = [
|
|
||||||
'host' => getenv('VICHAN_REDIS_HOST') ?: 'localhost',
|
|
||||||
'port' => (int)(getenv('VICHAN_REDIS_PORT') ?: 6379),
|
|
||||||
'password' => getenv('VICHAN_REDIS_PASSWORD') ?: '',
|
|
||||||
'database' => 1,
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$config['cache']['enabled'] = 'php';
|
$config['cache']['enabled'] = 'php';
|
||||||
}
|
$config['cache']['redis'] = array(
|
||||||
|
'host' => 'localhost',
|
||||||
|
'port' => 6379,
|
||||||
|
'password' => '',
|
||||||
|
'database' => 1
|
||||||
|
);
|
||||||
|
|
||||||
// Configure sessions to use Redis if enabled
|
// Determine if Redis is configured via environment variables
|
||||||
if ($redis_enabled) {
|
getenv('VICHAN_CACHE_ENGINE') && $config['cache']['enabled'] = getenv('VICHAN_CACHE_ENGINE');
|
||||||
$config['session']['enabled'] = 'redis';
|
|
||||||
$config['session']['redis'] = [
|
|
||||||
'host' => getenv('VICHAN_REDIS_HOST') ?: 'localhost',
|
|
||||||
'port' => (int)(getenv('VICHAN_REDIS_PORT') ?: 6379),
|
|
||||||
'password' => getenv('VICHAN_REDIS_PASSWORD') ?: '',
|
|
||||||
'database' => 1,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache timeout for cached objects
|
// Cache timeout for cached objects
|
||||||
$config['cache']['timeout'] = 60 * 60 * 48; // 48 hours
|
$config['cache']['timeout'] = 60 * 60 * 48; // 48 hours
|
||||||
@ -1869,6 +1853,18 @@
|
|||||||
// Enable public logs? 0: NO, 1: YES, 2: YES, but drop names
|
// Enable public logs? 0: NO, 1: YES, 2: YES, but drop names
|
||||||
$config['public_logs'] = 0;
|
$config['public_logs'] = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ====================
|
||||||
|
* Container settings
|
||||||
|
* ===================
|
||||||
|
*/
|
||||||
|
|
||||||
|
$isDocker = is_file("/.dockerenv") || is_file("/run/.containerenv");
|
||||||
|
$isKubernetes = is_file("/var/run/secrets/kubernetes.io/serviceaccount/namespace");
|
||||||
|
$config['is_container'] = $isDocker || $isKubernetes ? true : false;
|
||||||
|
$config['is_docker'] = $isDocker;
|
||||||
|
$config['is_kubernetes'] = $isKubernetes;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ====================
|
* ====================
|
||||||
* Events (PHP 5.3.0+)
|
* Events (PHP 5.3.0+)
|
||||||
|
|||||||
@ -684,7 +684,7 @@ if ($step == 0) {
|
|||||||
$page['body'] = '
|
$page['body'] = '
|
||||||
<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" disabled>' . htmlentities(file_get_contents('LICENSE.md')) . '</textarea>
|
<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" disabled>' . htmlentities(file_get_contents('LICENSE.md')) . '</textarea>
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
<button onclick="window.location.href=\'?step=1\'">I have read and understood the agreement. Proceed to installation.</button>
|
<a href="?step=1">I have read and understood the agreement. Proceed to installation.</a>
|
||||||
</p>';
|
</p>';
|
||||||
|
|
||||||
echo Element('page.html', $page);
|
echo Element('page.html', $page);
|
||||||
@ -1089,7 +1089,6 @@ if ($step == 0) {
|
|||||||
'<p><strong>Important:</strong> For security, please change the administrator password immediately after logging in.</p>' .
|
'<p><strong>Important:</strong> For security, please change the administrator password immediately after logging in.</p>' .
|
||||||
'<p style="text-align:center"><button onclick="window.location.href=\'/mod.php\'">Go to Admin Panel</button></p></div>';
|
'<p style="text-align:center"><button onclick="window.location.href=\'/mod.php\'">Go to Admin Panel</button></p></div>';
|
||||||
|
|
||||||
|
|
||||||
$boards = listBoards();
|
$boards = listBoards();
|
||||||
foreach ($boards as &$_board) {
|
foreach ($boards as &$_board) {
|
||||||
setupBoard($_board);
|
setupBoard($_board);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user