You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

#!/bin/bash
set -e
# Проект должен быть указан родительским скриптом
if [ ! -n "$PROJECT" ]; then
echo "❌ Проект не указан!"
exit 1
fi
CONFIG_DIR=${PROJECT_DIR}/config
mkdir ${CONFIG_DIR}
mkdir ${CONFIG_DIR}/composer
mkdir ${CONFIG_DIR}/mariadb
mkdir ${CONFIG_DIR}/nginx
mkdir ${CONFIG_DIR}/nginx/conf.d
mkdir ${CONFIG_DIR}/nginx/includes.d
mkdir ${CONFIG_DIR}/nginx/ssl.d
mkdir ${CONFIG_DIR}/redis
cat << EOF > ${CONFIG_DIR}/composer/auth.json
{
"github-oauth": {
"github.com": ""
}
}
EOF
cat << EOF > ${CONFIG_DIR}/mariadb/90-mysqld.cnf
[mysqld]
general_log=OFF
general_log_file=/var/log/mariadb/mariadb.log
EOF
cat << EOF > ${CONFIG_DIR}/nginx/conf.d/vhosts.conf
upstream php {
server php:9000;
}
map \$http_host \$root {
${PROJECT}.${DOMAIN_PLACEHOLDER} /var/www/${PROJECT};
}
server {
listen 80 default;
root \$root;
include includes.d/octobercms.conf;
include includes.d/staticfiles.conf;
client_max_body_size 300M;
large_client_header_buffers 4 32k;
location ~ ^/index.php {
fastcgi_pass php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param SERVER_NAME \$host;
}
}
EOF
cp /opt/stacks/structure/config/nginx/includes.d/octobercms.conf ${CONFIG_DIR}/nginx/includes.d/
cp /opt/stacks/structure/config/nginx/includes.d/staticfiles.conf ${CONFIG_DIR}/nginx/includes.d/
cat << EOF > ${CONFIG_DIR}/redis/redis-local.conf
port 6379
tcp-backlog 128
protected-mode no
stop-writes-on-bgsave-error no
databases 4
always-show-logo no
syslog-enabled yes
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
EOF
chown $P_UID:$P_GID -R ${CONFIG_DIR}