Skip to content

Commit

Permalink
Merge branch 'change-to-light-module'
Browse files Browse the repository at this point in the history
  • Loading branch information
patternhelloworld committed Dec 22, 2024
2 parents c4057c2 + 7d5c47f commit 6e7140e
Show file tree
Hide file tree
Showing 43 changed files with 203 additions and 881 deletions.
10 changes: 2 additions & 8 deletions .docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ RUN if getent group $shared_volume_group_id ; then \
groupadd -g $shared_volume_group_id $shared_volume_group_name && usermod -aG $shared_volume_group_name nginx; \
fi

RUN wget --no-check-certificate https://releases.hashicorp.com/consul-template/0.19.3/consul-template_0.19.3_linux_amd64.zip && \
unzip -d /usr/local/bin consul-template_0.19.3_linux_amd64.zip && \
rm -rf consul-template_0.19.3_linux_amd64.zip

COPY ./.docker/nginx/template/entrypoint.sh /
COPY ./.docker/nginx/template/nginx.service /etc/service/nginx/run/
COPY ./.docker/nginx/template/consul-template.service /etc/service/consul-template/run/

COPY ./.docker/nginx/template/nginx.conf.main /etc/nginx/nginx.conf
COPY ./.docker/nginx/template/ctmpl /ctmpl
COPY ./.docker/nginx/template/conf.d /conf.d
COPY ./.docker/nginx/template/logrotate/nginx /etc/logrotate.d/nginx

RUN chmod +x /etc/service/nginx/run && chmod +x /etc/service/consul-template/run
RUN sed -i -e 's/\r$//' /etc/service/consul-template/run/consul-template.service
RUN chmod +x /etc/service/nginx/run
RUN sed -i -e 's/\r$//' /etc/service/nginx/run/nginx.service
RUN rm /etc/nginx/conf.d/default.conf

Expand Down

This file was deleted.

36 changes: 0 additions & 36 deletions .docker/nginx/origin/conf.d/http/app/nginx.conf.ctmpl.origin

This file was deleted.

This file was deleted.

45 changes: 0 additions & 45 deletions .docker/nginx/origin/conf.d/https/app/nginx.conf.ctmpl.origin

This file was deleted.

File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions .docker/nginx/template/consul-template.service

This file was deleted.

22 changes: 9 additions & 13 deletions .docker/nginx/template/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ echo "[INSIDE_NGINX_CONTAINER][NOTICE] Start Logrotate (every hour at minute 1)
service cron restart || echo "[WARN] Restarting Cron failed."


# From this point on, the configuration of the NGINX consul-template begins.
if [[ ! -d /etc/consul-templates ]]; then
echo "[INSIDE_NGINX_CONTAINER][NOTICE] As the directory name '/etc/consul-templates' does NOT exist, it has been created."
mkdir /etc/consul-templates
# From this point on, the configuration of the NGINX template begins.
if [[ ! -d /etc/templates ]]; then
echo "[INSIDE_NGINX_CONTAINER][NOTICE] As the directory name '/etc/templates' does NOT exist, it has been created."
mkdir /etc/templates
fi

app_url=$(printenv APP_URL)
protocol=$(echo ${app_url} | awk -F[/:] '{print $1}')
echo "[INSIDE_NGINX_CONTAINER][NOTICE] Copy the template, contingency files for ${protocol} from '/ctmpl/${protocol}' to '/etc/consul-templates'."
echo "[INSIDE_NGINX_CONTAINER][NOTICE] Copy the prepared files for ${protocol} from '/conf.d/${protocol}' to '/etc/templates'."
sleep 2
cp -f /ctmpl/${protocol}/nginx.conf.ctmpl /etc/consul-templates
cp -f /ctmpl/${protocol}/nginx.conf.contingency.blue /etc/consul-templates
cp -f /ctmpl/${protocol}/nginx.conf.contingency.green /etc/consul-templates
cp -f /conf.d/${protocol}/nginx.conf.prepared.blue /etc/templates
cp -f /conf.d/${protocol}/nginx.conf.prepared.green /etc/templates

# SSL
if [[ ${protocol} = 'https' ]]; then
Expand Down Expand Up @@ -76,9 +75,8 @@ if [[ ${protocol} = 'https' ]]; then
chmod 644 /etc/nginx/ssl/${commercial_ssl_name}.chained.crt
chmod 644 /etc/nginx/ssl/${commercial_ssl_name}.crt

sed -i -e "s/!#{COMMERCIAL_SSL_NAME}/${commercial_ssl_name}/" /etc/consul-templates/nginx.conf.ctmpl || (echo "commercial_ssl_name (${commercial_ssl_name}) on .env failed to be applied. (ctmpl)" && exit 1)
sed -i -e "s/!#{COMMERCIAL_SSL_NAME}/${commercial_ssl_name}/" /etc/consul-templates/nginx.conf.contingency.blue || (echo "commercial_ssl_name (${commercial_ssl_name}) on .env failed to be applied. (contingency blue)" && exit 1)
sed -i -e "s/!#{COMMERCIAL_SSL_NAME}/${commercial_ssl_name}/" /etc/consul-templates/nginx.conf.contingency.green || (echo "commercial_ssl_name (${commercial_ssl_name}) on .env failed to be applied. (contingency green)" && exit 1)
sed -i -e "s/!#{COMMERCIAL_SSL_NAME}/${commercial_ssl_name}/" /etc/templates/nginx.conf.prepared.blue || (echo "commercial_ssl_name (${commercial_ssl_name}) on .env failed to be applied. (prepared blue)" && exit 1)
sed -i -e "s/!#{COMMERCIAL_SSL_NAME}/${commercial_ssl_name}/" /etc/templates/nginx.conf.prepared.green || (echo "commercial_ssl_name (${commercial_ssl_name}) on .env failed to be applied. (prepared green)" && exit 1)
fi


Expand All @@ -104,7 +102,5 @@ for retry_count in {1..5}; do
sleep 3
done

echo "[INSIDE_NGINX_CONTAINER][NOTICE] Applying the Nginx template..."
bash /etc/service/consul-template/run/consul-template.service
echo "[INSIDE_NGINX_CONTAINER][NOTICE] Start the Nginx."
bash /etc/service/nginx/run/nginx.service
7 changes: 1 addition & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ DOCKER_LAYER_CORRUPTION_RECOVERY=false


NGINX_RESTART=false
CONSUL_RESTART=false


# The method of acquiring Docker images:
Expand All @@ -37,8 +36,6 @@ PROJECT_PORT=xxx
# Samples : ADDITIONAL_PORTS=5005,5006
ADDITIONAL_PORTS=8093

CONSUL_KEY_VALUE_STORE=http://consul:8500/v1/kv/deploy/xxx

# If you locate your project on ../ (upper folder)
HOST_ROOT_LOCATION=../
# If you locate your project's Dockerfile ../ (upper folder)
Expand Down Expand Up @@ -88,6 +85,4 @@ NGINX_LOGROTATE_FILE_SIZE=1M

SHARED_VOLUME_GROUP_ID=1351
SHARED_VOLUME_GROUP_NAME=shared-volume-group
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=

USE_MY_OWN_NGINX_ORIGIN=false
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=
6 changes: 1 addition & 5 deletions .env.example.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


NGINX_RESTART=false
CONSUL_RESTART=false

# The method of acquiring Docker images:
# build (Used in developer's local environment or during Jenkins builds when a new image needs to be built, so this module is typically used)
Expand All @@ -29,7 +28,6 @@
# Example (8093,8094,11000...)
ADDITIONAL_PORTS=5005

CONSUL_KEY_VALUE_STORE=http://consul:8500/v1/kv/deploy/spring-sample-h-auth

# If you locate your project on ../ (upper folder)
HOST_ROOT_LOCATION=./samples/spring-sample-h-auth
Expand Down Expand Up @@ -79,6 +77,4 @@

SHARED_VOLUME_GROUP_ID=1351
SHARED_VOLUME_GROUP_NAME=shared-volume-group
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=

USE_MY_OWN_NGINX_ORIGIN=false
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=
6 changes: 1 addition & 5 deletions .env.example.java.commercial.ssl.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ DOCKER_LAYER_CORRUPTION_RECOVERY=false


NGINX_RESTART=false
CONSUL_RESTART=false


# The method of acquiring Docker images:
Expand All @@ -29,7 +28,6 @@ PROJECT_PORT=8300
# Example (8093,8094,11000...)
ADDITIONAL_PORTS=

CONSUL_KEY_VALUE_STORE=http://consul:8500/v1/kv/deploy/spring-sample-h-auth

# 1) ''/var/web/project/spring-sample-h-auth' is here
HOST_ROOT_LOCATION=/var/web/project/spring-sample-h-auth
Expand Down Expand Up @@ -81,6 +79,4 @@ NGINX_LOGROTATE_FILE_SIZE=1M

SHARED_VOLUME_GROUP_ID=1351
SHARED_VOLUME_GROUP_NAME=shared-volume-group
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=

USE_MY_OWN_NGINX_ORIGIN=false
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=
7 changes: 1 addition & 6 deletions .env.example.node
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ COMMERCIAL_SSL_NAME=yyy
DOCKER_LAYER_CORRUPTION_RECOVERY=false

NGINX_RESTART=false
CONSUL_RESTART=false

# The method of acquiring Docker images:
# build (Used in developer's local environment or during Jenkins builds when a new image needs to be built, so this module is typically used)
Expand All @@ -28,8 +27,6 @@ PROJECT_PORT=[13000,3000]
# Example (8093,8094,11000...)
ADDITIONAL_PORTS=

CONSUL_KEY_VALUE_STORE=http://consul:8500/v1/kv/deploy/node-express-boilerplate

# If you locate your project on ../ (upper folder)
HOST_ROOT_LOCATION=./samples/node-express-boilerplate
# If you locate your project's Dockerfile ../ (upper folder)
Expand Down Expand Up @@ -75,6 +72,4 @@ NGINX_LOGROTATE_FILE_SIZE=1M

SHARED_VOLUME_GROUP_ID=1351
SHARED_VOLUME_GROUP_NAME=shared-volume-group
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=

USE_MY_OWN_NGINX_ORIGIN=false
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=
9 changes: 2 additions & 7 deletions .env.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
DOCKER_LAYER_CORRUPTION_RECOVERY=false

NGINX_RESTART=false
CONSUL_RESTART=false

# The method of acquiring Docker images:
# build (Used in developer's local environment or during Jenkins builds when a new image needs to be built, so this module is typically used)
Expand All @@ -29,8 +28,6 @@
# Example (8093,8094,11000...)
ADDITIONAL_PORTS=

CONSUL_KEY_VALUE_STORE=http://consul:8500/v1/kv/deploy/laravel_crud_boilerplate

# If you locate your project on ../ (upper folder)
HOST_ROOT_LOCATION=./samples/laravel-crud-boilerplate
# If you locate your project's Dockerfile ../ (upper folder)
Expand Down Expand Up @@ -75,13 +72,11 @@
# ex. /docs/api-app.html
NGINX_RESTRICTED_LOCATION=xxx

REDIRECT_HTTPS_TO_HTTP=false
REDIRECT_HTTPS_TO_HTTP=true

NGINX_LOGROTATE_FILE_NUMBER=7
NGINX_LOGROTATE_FILE_SIZE=100K

SHARED_VOLUME_GROUP_ID=1351
SHARED_VOLUME_GROUP_NAME=laravel-shared-volume-group
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=1000

USE_MY_OWN_NGINX_ORIGIN=false
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=1000
Loading

0 comments on commit 6e7140e

Please sign in to comment.