Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Task/remove domain middleware release 1 14 0 #500

Closed
Closed
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
70 changes: 35 additions & 35 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FROM node:${NODE_VERSION}
ARG GITHUB_ACCOUNT=telefonicaid
ARG GITHUB_REPOSITORY=fiware-pep-steelskin
ARG DOWNLOAD=latest
ARG SOURCE_BRANCH=master
ARG SOURCE_BRANCH=task/remove_domain_middleware_release_1_14_0

# Copying Build time arguments to environment variables so they are persisted at run time and can be
# inspected within a running container.
Expand All @@ -51,44 +51,44 @@ ENV DOWNLOAD=${DOWNLOAD}
#
# hadolint ignore=DL3008,DL4001,DL4006
RUN apt-get update && \
# Ensure that unzip, wget and curl are installed
apt-get install -y --no-install-recommends unzip ca-certificates curl wget && \
if [ "${DOWNLOAD}" = "latest" ] ; \
then \
RELEASE="${SOURCE_BRANCH}"; \
echo "INFO: Building Latest Development from ${SOURCE_BRANCH} branch."; \
elif [ "${DOWNLOAD}" = "stable" ]; \
then \
RELEASE=$(curl -s https://api.github.com/repos/"${GITHUB_ACCOUNT}"/"${GITHUB_REPOSITORY}"/releases/latest | grep 'tag_name' | cut -d\" -f4); \
echo "INFO: Building Latest Stable Release: ${RELEASE}"; \
else \
RELEASE="${DOWNLOAD}"; \
echo "INFO: Building Release: ${RELEASE}"; \
fi && \
RELEASE_CONCAT=$(echo "${RELEASE}" | tr / -); \
wget --no-check-certificate -O source.zip https://github.com/"${GITHUB_ACCOUNT}"/"${GITHUB_REPOSITORY}"/archive/"${RELEASE}".zip && \
unzip source.zip && \
rm source.zip && \
mv "${GITHUB_REPOSITORY}-${RELEASE_CONCAT}" /opt/fiware-pep-steelskin && \
# Remove unzip and clean apt cache
apt-get clean && \
apt-get remove -y unzip && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*
# Ensure that unzip, wget and curl are installed
apt-get install -y --no-install-recommends unzip ca-certificates curl wget && \
if [ "${DOWNLOAD}" = "latest" ] ; \
then \
RELEASE="${SOURCE_BRANCH}"; \
echo "INFO: Building Latest Development from ${SOURCE_BRANCH} branch."; \
elif [ "${DOWNLOAD}" = "stable" ]; \
then \
RELEASE=$(curl -s https://api.github.com/repos/"${GITHUB_ACCOUNT}"/"${GITHUB_REPOSITORY}"/releases/latest | grep 'tag_name' | cut -d\" -f4); \
echo "INFO: Building Latest Stable Release: ${RELEASE}"; \
else \
RELEASE="${DOWNLOAD}"; \
echo "INFO: Building Release: ${RELEASE}"; \
fi && \
RELEASE_CONCAT=$(echo "${RELEASE}" | tr / -); \
wget --no-check-certificate -O source.zip https://github.com/"${GITHUB_ACCOUNT}"/"${GITHUB_REPOSITORY}"/archive/"${RELEASE}".zip && \
unzip source.zip && \
rm source.zip && \
mv "${GITHUB_REPOSITORY}-${RELEASE_CONCAT}" /opt/fiware-pep-steelskin && \
# Remove unzip and clean apt cache
apt-get clean && \
apt-get remove -y unzip && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

WORKDIR /opt/fiware-pep-steelskin
# hadolint ignore=DL3008,DL3009,DL3015
RUN \
# Ensure that Git is installed prior to running npm install
apt-get update && \
apt-get install -y git && \
echo "INFO: npm install --production..." && \
npm install --production && \
# Remove Git and clean apt cache
apt-get clean && \
apt-get remove -y git && \
apt-get -y autoremove && \
chmod +x docker/entrypoint.sh
# Ensure that Git is installed prior to running npm install
apt-get update && \
apt-get install -y git && \
echo "INFO: npm install --production..." && \
npm install --production && \
# Remove Git and clean apt cache
apt-get clean && \
apt-get remove -y git && \
apt-get -y autoremove && \
chmod +x docker/entrypoint.sh

USER node
ENV NODE_ENV=production
Expand Down
9 changes: 6 additions & 3 deletions lib/fiware-pep-steelskin.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ var http = require('http'),
authorization,
async = require('async'),
logger = require('logops'),
domainMiddleware = require('./middleware/domain').requestDomain(),
// Remove domainMiddleware (#498)
//domainMiddleware = require('./middleware/domain').requestDomain(),
cacheUtils = require('./services/cacheUtils'),
winston = require('winston'),
bodyParser = require('body-parser'),
Expand Down Expand Up @@ -230,7 +231,8 @@ function initializeProxy(proxyObj, callback) {
proxyObj.proxy.use(xmlRawBody);
proxyObj.proxy.use(rawBody);
proxyObj.proxy.use(bodyParser.urlencoded({limit: config.bodyLimit ? config.bodyLimit : '1Mb', extended: true}));
proxyObj.proxy.use(domainMiddleware);
// Remove domainMiddleware (#498)
//proxyObj.proxy.use(domainMiddleware);

if (config.logLevel && config.logLevel.toUpperCase() === 'DEBUG') {
proxyObj.proxy.use(traceRequest);
Expand Down Expand Up @@ -314,7 +316,8 @@ function initializeAdmin(proxyObj, callback) {
proxyObj.administration.use(bodyParser.json({limit: config.bodyLimit ? config.bodyLimit : '1Mb'}));
proxyObj.administration.use(bodyParser.urlencoded({limit: config.bodyLimit ? config.bodyLimit : '1Mb',
extended: true}));
proxyObj.administration.use(domainMiddleware);
// Remove domainMiddleware (#498)
// proxyObj.administration.use(domainMiddleware);
proxyObj.administration.use(handleError);

adminMiddleware.loadContextRoutes(proxyObj.administration);
Expand Down
4 changes: 2 additions & 2 deletions lib/services/cacheUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function createDomainEnabledCacheHandler(domain, processValueFn, cache, cacheTyp
callback(error);
} else {
var currentValue = cache.data[cacheType].get(cacheKey)[cacheKey] || value;

domain.enter();
// Remove domainMiddleware (#498)
//domain.enter();
logger.debug('Value found for cache type [%s] key [%s]: %j', cacheType, cacheKey, value);
logger.debug('Processing with value: %s', JSON.stringify(cache.data[cacheType].get(cacheKey)[cacheKey]));

Expand Down
3 changes: 2 additions & 1 deletion lib/services/keystoneAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ function extractRoles(req, res, next) {

function domainContinuator(domain, callback) {
return function() {
domain.enter();
// Remove domainMiddleware (#498)
//domain.enter();
callback();
};
}
Expand Down