Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _stack/fullstack/cms/app/conf/supervisor.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[program:php-fpm]
command=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
autostart=true
autorestart=true
stdout_logfile=/opt/app/log/php-fpm.log
stderr_logfile=/opt/app/log/php-fpm-error.log
46 changes: 46 additions & 0 deletions _stack/fullstack/cms/nginx/conf/app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
server {
server_name app.cms.sloopstash.*;

root /opt/app/source/web;
index index.php;

sendfile off;

server_tokens off;

error_log /opt/nginx/log/error.log warn;
access_log /opt/nginx/log/access.log;

large_client_header_buffers 4 16k;

location / {
try_files $uri /index.php?$query_string;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_pass app:9000;
}

location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}

location ~ /\. {
deny all;
}

location ~ ^/sites/.*/private {
deny all;
}

location ~* \.(yml|yaml|twig|theme|module|install|inc|profile|test|info)$ {
deny all;
}
}
10 changes: 10 additions & 0 deletions compose/DEV.env
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ NTM_APP_IP=14.1.7.20
NTM_NGINX_IP=14.1.7.30
NTM_NGINX_PORT=8001

CMS_MYSQL_VERSION=8.0.41
CMS_PHP_VERSION=8.3.4
CMS_NGINX_VERSION=1.24.0
CMS_APP_SOURCE=/opt/sloopstash-cms-app
CMS_NETWORK=14.1.10.0/24
CMS_MYSQL_IP=14.1.10.10
CMS_APP_IP=14.1.10.20
CMS_NGINX_IP=14.1.10.30
CMS_NGINX_PORT=8001

AIA_REDIS_VERSION=7.2.1
AIA_CHROMA_VERSION=1.1.4
AIA_OLLAMA_VERSION=0.9.6
Expand Down
10 changes: 10 additions & 0 deletions compose/QAA.env
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ NTM_APP_IP=15.1.7.20
NTM_NGINX_IP=15.1.7.30
NTM_NGINX_PORT=8002

CMS_MYSQL_VERSION=8.0.41
CMS_PHP_VERSION=8.3.4
CMS_NGINX_VERSION=1.24.0
CMS_APP_SOURCE=/opt/sloopstash-cms-app
CMS_NETWORK=14.1.10.0/24
CMS_MYSQL_IP=14.1.10.10
CMS_APP_IP=14.1.10.20
CMS_NGINX_IP=14.1.10.30
CMS_NGINX_PORT=8001

AIA_REDIS_VERSION=7.2.1
AIA_CHROMA_VERSION=1.1.4
AIA_OLLAMA_VERSION=0.9.6
Expand Down
10 changes: 10 additions & 0 deletions compose/QAB.env
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ NTM_APP_IP=16.1.7.20
NTM_NGINX_IP=16.1.7.30
NTM_NGINX_PORT=8003

CMS_MYSQL_VERSION=8.0.41
CMS_PHP_VERSION=8.3.4
CMS_NGINX_VERSION=1.24.0
CMS_APP_SOURCE=/opt/sloopstash-cms-app
CMS_NETWORK=14.1.10.0/24
CMS_MYSQL_IP=14.1.10.10
CMS_APP_IP=14.1.10.20
CMS_NGINX_IP=14.1.10.30
CMS_NGINX_PORT=8001

AIA_REDIS_VERSION=7.2.1
AIA_CHROMA_VERSION=1.1.4
AIA_OLLAMA_VERSION=0.9.6
Expand Down
67 changes: 67 additions & 0 deletions compose/fullstack/cms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: '3.8'
services:
mysql:
image: sloopstash/mysql:v${CMS_MYSQL_VERSION}
entrypoint: /usr/bin/supervisord
command: "-c /etc/supervisord.conf"
volumes:
- mysql-data:/opt/mysql/data
- mysql-log:/opt/mysql/log
- ${HOME_DIR}/workload/supervisor/conf/server.conf:/etc/supervisord.conf
- ${HOME_DIR}/workload/mysql/${CMS_MYSQL_VERSION}/conf/supervisor.ini:/opt/mysql/system/supervisor.ini
- ${HOME_DIR}/workload/mysql/${CMS_MYSQL_VERSION}/conf/server.conf:/opt/mysql/conf/server.conf
- ${HOME_DIR}/workload/mysql/${CMS_MYSQL_VERSION}/conf/initialize.conf:/opt/mysql/conf/initialize.conf

networks:
common:
ipv4_address: ${CMS_MYSQL_IP}
app:
image: sloopstash/php:v${CMS_PHP_VERSION}
entrypoint: /usr/bin/supervisord
command: "-c /etc/supervisord.conf"
environment:
- STATIC_ENDPOINT=app-static.cms.${EXTERNAL_DOMAIN}:${CMS_NGINX_PORT}
volumes:
- ${CMS_APP_SOURCE}:/opt/app/source
- app-log:/opt/app/log
- ${HOME_DIR}/workload/supervisor/conf/server.conf:/etc/supervisord.conf
- ${HOME_DIR}/_stack/fullstack/cms/app/conf/supervisor.ini:/opt/app/system/supervisor.ini
depends_on:
- mysql
networks:
common:
ipv4_address: ${CMS_APP_IP}
nginx:
image: sloopstash/nginx:v${CMS_NGINX_VERSION}
entrypoint: /usr/bin/supervisord
command: "-c /etc/supervisord.conf"
ports:
- "${CMS_NGINX_PORT}:80"
volumes:
- ${CMS_APP_SOURCE}:/opt/app/source
- nginx-log:/opt/nginx/log
- ${HOME_DIR}/workload/supervisor/conf/server.conf:/etc/supervisord.conf
- ${HOME_DIR}/workload/nginx/${CMS_NGINX_VERSION}/conf/supervisor.ini:/opt/nginx/system/supervisor.ini
- ${HOME_DIR}/workload/nginx/${CMS_NGINX_VERSION}/conf/server.conf:/opt/nginx/conf/server.conf
- ${HOME_DIR}/_stack/fullstack/cms/nginx/conf/app.conf:/opt/nginx/conf/app.conf
depends_on:
- app
networks:
common:
ipv4_address: ${CMS_NGINX_IP}
volumes:
mysql-data:
driver: local
mysql-log:
driver: local
app-log:
driver: local
nginx-log:
driver: local
networks:
common:
driver: bridge
ipam:
driver: default
config:
- subnet: ${CMS_NETWORK}
53 changes: 53 additions & 0 deletions image/mysql/8.0.41/amazon-linux-2.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Docker image to use.
FROM sloopstash/base:v1.2.1 AS install_mysql

# Download and install MySQL 8.0.41 binary.
WORKDIR /tmp
RUN set -x \
&& yum update -y \
&& yum install -y wget xz libaio numactl-libs ncurses-compat-libs \
&& yum clean all \
&& rm -rf /var/cache/yum \
&& wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.41-linux-glibc2.17-x86_64.tar.xz \
&& tar -xJf mysql-8.0.41-linux-glibc2.17-x86_64.tar.xz \
&& mv mysql-8.0.41-linux-glibc2.17-x86_64 /usr/local/mysql

# Create MySQL directories.
FROM sloopstash/base:v1.2.1 AS create_mysql_directories

RUN set -x \
&& mkdir -p /opt/mysql/data \
&& mkdir -p /opt/mysql/log \
&& mkdir -p /opt/mysql/conf \
&& mkdir -p /opt/mysql/script \
&& mkdir -p /opt/mysql/system \
&& touch /opt/mysql/system/server.pid \
&& touch /opt/mysql/system/supervisor.ini

# Final image.
FROM sloopstash/base:v1.2.1

# Install runtime dependencies.
RUN yum install -y libaio numactl-libs ncurses-compat-libs \
&& yum clean all \
&& rm -rf /var/cache/yum

# Create MySQL user.
RUN useradd -m mysql

# Copy MySQL installation.
COPY --from=install_mysql /usr/local/mysql /usr/local/mysql

ENV PATH=/usr/local/mysql/bin:$PATH

# Copy MySQL directories.
COPY --from=create_mysql_directories /opt/mysql /opt/mysql

# Configure permissions.
RUN set -x \
&& ln -s /opt/mysql/system/supervisor.ini /etc/supervisord.d/mysql.ini \
&& chown -R mysql:mysql /opt/mysql \
&& chown -R mysql:mysql /usr/local/mysql

# Default working directory.
WORKDIR /opt/mysql
4 changes: 4 additions & 0 deletions image/mysql/8.0.41/context/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory.
*
# Except this file.
!.gitignore
52 changes: 52 additions & 0 deletions image/php/8.3.4/amazon-linux-2.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Docker image to use.
FROM sloopstash/base:v1.1.1

# Install system packages required for PHP + Drupal.
RUN set -x \
&& yum install -y amazon-linux-extras wget gcc gcc-c++ make autoconf bison re2c libxml2-devel sqlite-devel openssl-devel curl-devel libpng-devel libjpeg-devel freetype-devel oniguruma-devel libzip-devel libicu-devel bzip2-devel \
&& yum clean all

# Download and extract PHP.
WORKDIR /tmp
RUN set -x \
&& wget https://www.php.net/distributions/php-8.3.4.tar.gz --quiet \
&& tar xvzf php-8.3.4.tar.gz > /dev/null

# Compile and install PHP.
WORKDIR php-8.3.4
RUN set -x \
&& export CC="gcc" \
&& export CFLAGS="-fPIE" \
&& export CXXFLAGS="-fPIE" \
&& export LDFLAGS="-pie" \
&& ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-curl --with-zlib --enable-mbstring --enable-intl --enable-opcache --enable-gd --with-jpeg --with-freetype --with-zip \
&& make clean \
&& make -j$(nproc) \
&& make install

# Configure PHP-FPM.
RUN set -x \
&& mkdir -p /usr/local/php/etc \
&& cp php.ini-production /usr/local/php/etc/php.ini \
&& cp sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf \
&& mkdir -p /usr/local/php/etc/php-fpm.d \
&& cp sapi/fpm/www.conf /usr/local/php/etc/php-fpm.d/www.conf \
&& sed -i 's#^listen =.*#listen = 0.0.0.0:9000#' /usr/local/php/etc/php-fpm.d/www.conf \
&& sed -i 's#^;daemonize = yes#daemonize = no#' /usr/local/php/etc/php-fpm.conf

# Add PHP to PATH.
ENV PATH=/usr/local/php/bin:/usr/local/php/sbin:$PATH

# Create App directories.
WORKDIR /tmp
RUN set -x \
&& rm -rf php-8.3.4* \
&& mkdir -p /opt/app/source \
&& mkdir -p /opt/app/log \
&& mkdir -p /opt/app/system \
&& touch /opt/app/system/supervisor.ini \
&& ln -s /opt/app/system/supervisor.ini /etc/supervisord.d/app.ini \
&& history -c

# Set default work directory.
WORKDIR /opt/app
4 changes: 4 additions & 0 deletions image/php/8.3.4/context/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory.
*
# Except this file.
!.gitignore
15 changes: 15 additions & 0 deletions workload/mysql/8.0.41/conf/initialize.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
FLUSH PRIVILEGES;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

CREATE USER 'drupal_user'@'%' IDENTIFIED BY 'drupal_php_nginx';

CREATE DATABASE drupal_cms CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

GRANT ALL PRIVILEGES ON drupal_cms.* TO 'drupal_user'@'%';
FLUSH PRIVILEGES;
29 changes: 29 additions & 0 deletions workload/mysql/8.0.41/conf/server.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# MySQL Server configuration

[mysqld]

# Run the MySQL server as this operating system user.
user=mysql

# Data directory where database files are stored.
datadir=/opt/mysql/data

# PID file containing the MySQL server process ID.
pid-file=/opt/mysql/system/server.pid

# Socket file used for local client connections.
socket=/opt/mysql/system/mysql.sock

# Network settings.
port=5000
bind-address=0.0.0.0

# Logging
log-error=/opt/mysql/log/error.log
general_log=ON
general_log_file=/opt/mysql/log/general.log
slow_query_log=ON
slow_query_log_file=/opt/mysql/log/slow-query.log

# SQL mode to enforce stricter SQL behavior.
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
14 changes: 14 additions & 0 deletions workload/mysql/8.0.41/conf/supervisor.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[group:mysql]
programs=init,server

[program:init]
command=su mysql bash -c "if [ ! -d /opt/mysql/data/mysql ] || [ -z \"$(ls -A /opt/mysql/data/mysql 2>/dev/null)\" ]; then mysqld --defaults-file=/opt/mysql/conf/server.conf --initialize-insecure; fi"
process_name=%(program_name)s
autorestart=false
priority=100

[program:server]
command=su mysql bash -c "mysqld --defaults-file=/opt/mysql/conf/server.conf"
process_name=%(program_name)s
autorestart=true
priority=200