This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def exec(Map map = [:], command){ | |
def debug = map.debug ?: false | |
if (debug) echo "[DEBUG] powershell method called with parameter: \n $command" | |
def returnFileName = new Date().format("yyyyMMddHHmmssSSS") | |
if (debug) echo "[DEBUG] The return file name will is $returnFileName" | |
def pwCommand = "powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -Command \"$command\" > $returnFileName" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def powershell | |
def isInstalled(Map map = [:], hostName, serviceName){ | |
def debug = map.debug ?: false | |
if (debug) echo "[DEBUG] isInstalled method called: hostName:\"$hostName\", serviceName:\"$serviceName\"" | |
def pwret = powershell.exec("(get-service -ComputerName $hostName | Where-Object {\$_.name -eq \\\"$serviceName\\\"})", debug: debug) | |
def installed = (pwret.trim().length() > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mongooseValidator(err, req, res, next) => { | |
if (err !== 'undefined' && err.name !== 'undefined' && err.name === 'ValidationError') | |
return handleValidationError(err, res); | |
if (err !== 'undefined' && err.code === 11000) | |
return handleDuplicateValidationError(err, res); | |
next(err); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
RUN apt-get -y update && apt-get install -y \ | |
wget \ | |
build-essential \ | |
libpcre3-dev \ | |
zlib1g-dev | |
ENV NGINX_VERSION=1.11.12 | |
ENV NPS_VERSION=1.11.33.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENTRYPOINT \sed -i 's/%%NGX_LOGLEVEL%%/'"$NGX_LOGLEVEL"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NGX_UPSTREAM_NAME%%/'"$NGX_UPSTREAM_NAME"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NGX_UPSTREAM_SERVER%%/'"$NGX_UPSTREAM_SERVER"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_ENABLED%%/'"$NPS_ENABLED"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_LOWERCASEHTMLNAMES%%/'"$NPS_LOWERCASEHTMLNAMES"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_ENABLEFILTERS%%/'"$NPS_ENABLEFILTERS"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_RESPECTVARY%%/'"$NPS_RESPECTVARY"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_DISABLEREWRITEONNOTRANSFORM%%/'"$NPS_DISABLEREWRITEONNOTRANSFORM"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_MODIFYCACHINGHEADERS%%/'"$NPS_MODIFYCACHINGHEADERS"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
/usr/local/nginx/sbin/./nginx -g 'daemon off;'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vamos copiar alguns arquivos para dentro do container. | |
COPY content/nginx.conf /usr/local/nginx/conf/ | |
COPY content/robots.txt /usr/local/nginx/html/ | |
# Estas linhas servem para que os logs do Nginx sejam apresentadas no console do container. | |
RUN ln -sf /dev/stdout /usr/local/nginx/logs/access.log | |
RUN ln -sf /dev/stderr /usr/local/nginx/logs/error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Estas são as configurações que utilizamos no nginx. | |
ENV NGX_LOGLEVEL debug | |
ENV NGX_UPSTREAM_NAME www.google.com | |
ENV NGX_UPSTREAM_SERVER www.google.com:80 | |
# Estas são as configurações que utilizaremos no PageS | |
ENV NPS_ENABLED on | |
ENV NPS_LOWERCASEHTMLNAMES on | |
ENV NPS_RESPECTVARY off | |
ENV NPS_DISABLEREWRITEONNOTRANSFORM on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Removendo todo o código fonte baixado para a compilação. | |
RUN rm -rf /usr/nginx_source | |
# Limpando os pacotes desnecessários para e execução do container. | |
RUN apt-get purge -y \ | |
wget \ | |
build-essential \ | |
libpcre3-dev \ | |
zlib1g-dev \ | |
&& apt-get autoremove -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compilando o Nginx | |
WORKDIR "/usr/nginx_source/nginx-$NGINX_VERSION/" | |
RUN ./configure \ | |
--add-module=/usr/nginx_source/ngx_pagespeed-latest-stable \ | |
--add-module=/usr/nginx_source/ngx_http_substitutions_filter_module-$SUBS_VERSION | |
RUN make | |
RUN make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV NGINX_VERSION=1.11.12 | |
ENV NPS_VERSION=1.11.33.5 | |
ENV PSOL_VERSION=1.11.33.4 | |
ENV SUBS_VERSION=0.6.4 | |
# Criamos a pasta que conterá o nosso código fonte. | |
RUN ["mkdir","/usr/nginx_source/"] | |
WORKDIR "/usr/nginx_source/" | |
# Baixamos o código do Nginx da versão que selecionamos. |
NewerOlder