lighthouse-runner

This commit is contained in:
David Adewole 2021-06-30 12:56:08 +01:00
parent 4734e69505
commit abdf71ec8c
5 changed files with 107 additions and 2 deletions

View File

@ -282,5 +282,25 @@ services:
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
lighthouse-runner:
ports:
- '3001:3001'
- '9241:9229' # Debugging port.
build:
context: ./lighthouse-runner
dockerfile: ./Dockerfile.dev
env_file:
- ./lighthouse-runner/.env
environment:
- PORT=3001
- SERVER_URL=http://backend:3002
- LIGHTHOUSE_NAME=US
- LIGHTHOUSE_KEY=test-key
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
volumes:
- ./lighthouse-runner:/usr/src/app
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
volumes:
mongodata:

View File

@ -192,6 +192,18 @@ services:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
depends_on:
- backend
lighthouse-runner:
ports:
- '3001:3001'
build: ./lighthouse-runner
env_file:
- ./lighthouse-runner/.env
environment:
- PORT=3001
- SERVER_URL=http://backend:3002
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
depends_on:
- backend
volumes:
mongodata:

36
lighthouse-runner/Dockerfile Executable file
View File

@ -0,0 +1,36 @@
#
# Fyipe-backend Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PRODUCTION=true
ENV CHROME_PATH=/usr/bin/google-chrome
# Install Chrome.
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && \
apt-get install -y google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
# Expose ports.
# - 3001: Lighthouse Runner
EXPOSE 3001
#Run the app
CMD [ "npm", "start"]

View File

@ -0,0 +1,38 @@
#
# Fyipe-backend Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV CHROME_PATH=/usr/bin/google-chrome
WORKDIR /usr/src/app
# Install Chrome.
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && \
apt-get install -y google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
RUN npm ci
# Expose ports.
# - 3001: Lighthouse Runner
EXPOSE 3001
#Run the app
CMD [ "npm", "run", "dev"]

View File

@ -14,8 +14,7 @@ module.exports = {
if(probe.length > 0){ // This checks that the probe server is working
return UrlMonitors.ping(monitor);
}else{
//eslint-disable-next-line
console.log("Please Make Sure Probe Server is Up and Running!")
ErrorService.log('getApi',"Please Make Sure Probe Server is Online.")
}
}
return null;