Дипломная работа: Автоматизация доставки программного обеспечения при помощи DevOps практик и инструментов в облаке AWS в компании ООО "Команда Лабс"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
116
INSTALL_LOG_FILE_PATH=${INSTALL_LOG_FOLDER_PATH}/${LO
G_FILE}
NGINX_SRC_FOLDER_PATH=${SRC_FOLDER_PATH}/${NGINX_PRE
}${NGINX_VER}
PCRE_SRC_FOLDER_PATH=${SRC_FOLDER_PATH}/${PCRE_PRE}${
PCRE_VER}
ZLIB_SRC_FOLDER_PATH=${SRC_FOLDER_PATH}/${ZLIB_PRE}${
ZLIB_VER}
OPENSSL_SRC_FOLDER_PATH=${SRC_FOLDER_PATH}/${OPENSSL
_PRE}${OPENSSL_VER}
HEADERS_MORE_FOLDER_PATH=${SRC_FOLDER_PATH}/headers-
more-nginx-module-0.33
NGINX_SRC_TAR=${NGINX_PRE}${NGINX_VER}${EXT_TAR}
PCRE_SRC_TAR=${PCRE_PRE}${PCRE_VER}${EXT_TAR}
ZLIB_SRC_TAR=${ZLIB_PRE}${ZLIB_VER}${EXT_TAR}
OPENSSL_SRC_TAR=${OPENSSL_PRE}${OPENSSL_VER}${EXT_TA
R}
HEADERS_MORE_TAR=${HEADERS_MORE_PRE}${HEADERS_MOR
E_VER}${EXT_TAR}
GEOIP1_DB_TAR=${GEOIP1_PRE}${EXT_TAR}
GEOIP2_DB_TAR=${GEOIP2_PRE}${EXT_TAR}
GEOIP1_DB_FOLDER=${GEOIP1_PRE}_${GEOIP_VER}
GEOIP2_DB_FOLDER=${GEOIP2_PRE}_${GEOIP_VER}
GEOIP1_DB_FILE=${GEOIP1_PRE}${EXT_DB}
GEOIP2_DB_FILE=${GEOIP2_PRE}${EXT_DB}
117
ALL_SRC_FILES_TAR=${NGINX_PRE}${NGINX_VER}-
${SRC_FOLDER}${EXT_TAR}
DEB_PKG_FILE=nginx_${NGINX_VER}-1_amd64.deb
echo "$(date +"%d-%b-%Y-%H-%M-%S") | Downloading source files..." |&
tee -a ${INSTALL_LOG_FILE_PATH}
# Download and extract the source code for the latest version of NGINX
cd $SRC_FOLDER_PATH
sudo wget http://nginx.org/download/$NGINX_SRC_TAR >>
${INSTALL_LOG_FILE_PATH} 2>&1 && \
sudo tar xzf $NGINX_SRC_TAR >> ${INSTALL_LOG_FILE_PATH}
2>&1
# Download and extract the latest versions of PCRE, zlib and OpenSSL
libraries
sudo wget https://ftp.pcre.org/pub/pcre/${PCRE_SRC_TAR} >>
${INSTALL_LOG_FILE_PATH} 2>&1 && \
sudo tar xzf $PCRE_SRC_TAR >> ${INSTALL_LOG_FILE_PATH} 2>&1
sudo wget http://zlib.net/${ZLIB_SRC_TAR} >>
${INSTALL_LOG_FILE_PATH} 2>&1 && \
sudo tar xzf $ZLIB_SRC_TAR >> ${INSTALL_LOG_FILE_PATH} 2>&1
sudo wget https://www.openssl.org/source/${OPENSSL_SRC_TAR} >>
${INSTALL_LOG_FILE_PATH} 2>&1 && \
sudo tar xzf $OPENSSL_SRC_TAR >> ${INSTALL_LOG_FILE_PATH}
2>&1
118
#sudo https://github.com/openresty/headers-more-nginx-
module/archive/${HEADERS_MORE_VER}${EXT_TAR} >>
${INSTALL_LOG_FILE_PATH} 2>&1 && \
# sudo tar xzf $HEADERS_MORE_TAR >>
${INSTALL_LOG_FILE_PATH} 2>&1
sudo wget https://github.com/openresty/headers-more-nginx-
module/archive/v0.33.tar.gz >> ${INSTALL_LOG_FILE_PATH} 2>&1 && \
sudo tar xzf v0.33.tar.gz >> ${INSTALL_LOG_FILE_PATH} 2>&1
# Download (third party) NGINX modules: cache purge and GeoIP2
# The GeoIP module included with NGINX only works with v1 MaxMind
database files
# V2 database files are far superior, see here for more info:
# https://dev.maxmind.com/geoip/geoip2/whats-new-in-geoip2/
sudo git clone --recursive https://github.com/FRiCKLE/ngx_cache_purge.git
>> ${INSTALL_LOG_FILE_PATH} 2>&1
sudo git clone --recursive https://github.com/leev/ngx_http_geoip2_module.git
>> ${INSTALL_LOG_FILE_PATH} 2>&1
# Remove archive files
sudo rm -rf *.tar.gz >> ${INSTALL_LOG_FILE_PATH} 2>&1
echo "$(date +"%d-%b-%Y-%H-%M-%S") | Building NGINX from source..."
|& tee -a ${INSTALL_LOG_FILE_PATH}
# Configure the build options for NGINX
cd $NGINX_SRC_FOLDER_PATH
sudo ./configure \
--prefix=/usr/share/nginx \
--sbin-path=/usr/sbin/nginx \
119
--modules-path=/usr/lib/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=www-data \
--group=www-data \
--build=Ubuntu \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-openssl=$OPENSSL_SRC_FOLDER_PATH \
--with-openssl-opt=enable-ec_nistp_64_gcc_128 \
--with-openssl-opt=no-nextprotoneg \
--with-openssl-opt=no-weak-ssl-ciphers \
--with-openssl-opt=no-ssl3 \
--with-pcre=$PCRE_SRC_FOLDER_PATH \
--with-pcre-jit \
--with-zlib=$ZLIB_SRC_FOLDER_PATH \
--with-compat \
--with-file-aio \
--with-threads \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gunzip_module \
120
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_secure_link_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-debug \
--add-module=../ngx_http_geoip2_module \
--add-module=../ngx_cache_purge \
--add-module=$HEADERS_MORE_FOLDER_PATH \
--with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-z,relro -Wl,--as-needed' >>
${INSTALL_LOG_FILE_PATH} 2>&1
# Build nginx with the specified configuration
sudo make >> ${INSTALL_LOG_FILE_PATH} 2>&1
# Create a .deb package (instead of running `sudo make install`)
sudo checkinstall --install=no -y >> ${INSTALL_LOG_FILE_PATH} 2>&1
Источник: https://baza.diplomsite.ru/previewfile/1758