Some features for docker users

Disable IP Check on install
automatically fill out server_path
This commit is contained in:
slawkens 2023-09-17 14:39:02 +02:00
parent 72d7ee8bf2
commit 49af260c2e
6 changed files with 16 additions and 16 deletions

View File

@ -15,28 +15,21 @@ RUN apt-get update && apt-get install -y \
libxml2-dev \ libxml2-dev \
libzip-dev \ libzip-dev \
zip \ zip \
unzip unzip \
nano \
vim
# Clear cache # Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/* RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions # Install PHP extensions
RUN docker-php-ext-install pdo pdo_mysql gd zip opcache RUN docker-php-ext-install pdo pdo_mysql gd zip opcache
RUN docker-php-ext-configure opcache --enable-opcache RUN docker-php-ext-configure opcache --enable-opcache
#INSTALL APCU
RUN pecl install apcu-${APCU_VERSION} && docker-php-ext-enable apcu RUN pecl install apcu-${APCU_VERSION} && docker-php-ext-enable apcu
RUN echo "extension=apcu.so" >> /usr/local/etc/php/php.ini
RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/php.ini
RUN echo "apc.enable=1" >> /usr/local/etc/php/php.ini
#APCU
# Get latest Composer # Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY docker/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Create system user to run Composer Commands # Create system user to run Composer Commands
#RUN useradd -G www-data,root -u $uid -d /home/$user $user #RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \ RUN mkdir -p /home/$user/.composer && \
@ -49,7 +42,8 @@ USER $user
WORKDIR /home/$user WORKDIR /home/$user
RUN git clone https://github.com/otland/forgottenserver.git RUN git clone https://github.com/otland/forgottenserver.git
COPY docker/config.lua /home/$user/forgottenserver COPY --chown=www-data:www-data docker/config.lua /home/$user/forgottenserver
COPY --chown=www-data:www-data docker/config.local.php /var/www/html
#WORKDIR /home/$user/forgottenserver #WORKDIR /home/$user/forgottenserver

View File

@ -1,2 +0,0 @@
[opcache]
opcache.enable=1

View File

@ -195,7 +195,7 @@ if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
} }
} }
if(!$allow) if(!$allow && !config('install_ignore_ip_check'))
{ {
$content = warning('In file <b>install/ip.txt</b> must be your IP!<br/> $content = warning('In file <b>install/ip.txt</b> must be your IP!<br/>
In file is:<br /><b>' . nl2br($file_content) . '</b><br/> In file is:<br /><b>' . nl2br($file_content) . '</b><br/>

View File

@ -11,6 +11,7 @@ foreach($config['clients'] as $client) {
} }
$twig->display('install.config.html.twig', array( $twig->display('install.config.html.twig', array(
'config' => $config,
'clients' => $clients, 'clients' => $clients,
'timezones' => DateTimeZone::listIdentifiers(), 'timezones' => DateTimeZone::listIdentifiers(),
'locale' => $locale, 'locale' => $locale,

View File

@ -37,6 +37,9 @@ if(!$error) {
$configToSave['gzip_output'] = false; $configToSave['gzip_output'] = false;
$configToSave['cache_engine'] = 'auto'; $configToSave['cache_engine'] = 'auto';
$configToSave['cache_prefix'] = 'myaac_' . generateRandomString(8, true, false, true); $configToSave['cache_prefix'] = 'myaac_' . generateRandomString(8, true, false, true);
if (isset($config['install_ignore_ip_check'])) {
$configToSave['install_ignore_ip_check'] = $config['install_ignore_ip_check'];
}
require BASE . 'install/includes/config.php'; require BASE . 'install/includes/config.php';
@ -84,7 +87,7 @@ if(!$error) {
$_SESSION['config_content'] = $content; $_SESSION['config_content'] = $content;
unset($_SESSION['saved']); unset($_SESSION['saved']);
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.php</b>', $locale['step_database_error_file']); $locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
error($locale['step_database_error_file'] . '<br/> error($locale['step_database_error_file'] . '<br/>
<textarea cols="70" rows="10">' . $content . '</textarea>'); <textarea cols="70" rows="10">' . $content . '</textarea>');
} }

View File

@ -10,9 +10,13 @@
<input type="hidden" name="step" id="step" value="database" /> <input type="hidden" name="step" id="step" value="database" />
{% for value in ['server_path'] %} {% for value in ['server_path'] %}
{% if value == 'server_path' and config.server_path is not null %}
{% set server_path = { 'var_server_path': config.server_path } %}
{% set session = session | merge (server_path) %}
{% endif %}
<div class="form-group mb-2"> <div class="form-group mb-2">
<label for="vars_{{ value }}">{{ locale['step_config_' ~ value] }}</label> <label for="vars_{{ value }}">{{ locale['step_config_' ~ value] }}</label>
<input class="form-control" type="{% if value == 'mail_admin' %}email{% else %}text{% endif %}" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/> <input class="form-control" type="text" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/>
<small class="form-text text-muted">{{ locale['step_config_' ~ value ~ '_desc'] }}</small> <small class="form-text text-muted">{{ locale['step_config_' ~ value ~ '_desc'] }}</small>
</div> </div>
{% endfor %} {% endfor %}