-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Automattic/add/dockerize-app-node-16
Jetmon: Dockerize app
- Loading branch information
Showing
18 changed files
with
200 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
build/ | ||
node_modules/ | ||
node_modules/ | ||
.DS_Store | ||
lib/jetmon.node | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config.json | ||
db-config.conf | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
$db_servers = array( | ||
'misc' => array( | ||
array( 'jetmon', 0, 1, 'mysqldb:<MYSQLDB_PORT>', 'mysqldb:<MYSQLDB_PORT>', '<MYSQLDB_DATABASE>', '<MYSQLDB_USER>', '<MYSQLDB_ROOT_PASSWORD>', null, null, 30 ), | ||
array( 'jetmon', 1, 0, 'mysqldb:<MYSQLDB_PORT>', 'mysqldb:<MYSQLDB_PORT>', '<MYSQLDB_DATABASE>', '<MYSQLDB_USER>', '<MYSQLDB_ROOT_PASSWORD>', null, null, 30 ), | ||
) | ||
); |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
build/ | ||
node_modules/ | ||
.DS_Store | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
MYSQLDB_USER=root | ||
MYSQLDB_ROOT_PASSWORD=123456 | ||
MYSQLDB_DATABASE=jetmon_db | ||
MYSQLDB_LOCAL_PORT=3307 | ||
MYSQLDB_DOCKER_PORT=3306 | ||
|
||
JETMON_LOCAL_PORT=7800 | ||
JETMON_DOCKER_PORT=7800 | ||
|
||
WPCOM_JETMON_AUTH_TOKEN=change_me | ||
|
||
VERIFLIER_LOCAL_PORT=7801 | ||
VERIFLIER_DOCKER_PORT=7801 | ||
VERIFLIER_AUTH_TOKEN=veriflier_1_auth_token |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:16 | ||
|
||
WORKDIR /jetmon | ||
|
||
# RUN apk add --no-cache python3 make g++ | ||
|
||
RUN npm config set unsafe-perm true | ||
RUN npm install -g node-gyp | ||
|
||
# Get the dependencies loaded first - this makes rebuilds faster | ||
COPY package.json . | ||
RUN npm install | ||
|
||
COPY . . | ||
|
||
CMD [ "bash", "docker/run-jetmon.sh" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM ubuntu:18.04 | ||
# Sourced from https://github.com/MatiMoreyra/qt5-docker/blob/master/Dockerfile | ||
|
||
# Install dependencies. | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
git \ | ||
build-essential \ | ||
cmake \ | ||
qt5-default \ | ||
libfontconfig1 \ | ||
mesa-common-dev \ | ||
libglu1-mesa-dev \ | ||
libgtest-dev | ||
|
||
# Build GTest | ||
RUN cd /usr/src/gtest/ && \ | ||
cmake -DBUILD_SHARED_LIBS=ON && \ | ||
make && \ | ||
cp -a include/gtest /usr/include && \ | ||
cp -a libgtest_main.so libgtest.so /usr/lib/ | ||
|
||
# Cleanup | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
WORKDIR /opt | ||
|
||
COPY . . | ||
|
||
CMD [ "bash", "docker/run-veriflier.sh" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version: '3.8' | ||
|
||
services: | ||
mysqldb: | ||
image: mysql:5.7 | ||
restart: unless-stopped | ||
env_file: | ||
- .env | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD | ||
- MYSQL_DATABASE=$MYSQLDB_DATABASE | ||
ports: | ||
- $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT | ||
volumes: | ||
- db:/var/lib/mysql | ||
jetmon: | ||
hostname: docker.jetmon.dev.com | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile_jetmon | ||
env_file: | ||
- .env | ||
volumes: | ||
- ../:/jetmon | ||
# Don't sync the node_modules directory back to the client. | ||
- "/jetmon/node_modules" | ||
environment: | ||
- DB_HOST=mysqldb | ||
- DB_USER=$MYSQLDB_USER | ||
- DB_PASSWORD=$MYSQLDB_ROOT_PASSWORD | ||
- DB_NAME=$MYSQLDB_DATABASE | ||
- DB_PORT=$MYSQLDB_DOCKER_PORT | ||
- VERIFLIER_AUTH_TOKEN=$VERIFLIER_AUTH_TOKEN | ||
- VERIFLIER_PORT=$VERIFLIER_DOCKER_PORT | ||
- WPCOM_JETMON_AUTH_TOKEN=$WPCOM_JETMON_AUTH_TOKEN | ||
ports: | ||
- $JETMON_LOCAL_PORT:$JETMON_DOCKER_PORT | ||
depends_on: | ||
- mysqldb | ||
veriflier: | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile_veriflier | ||
volumes: | ||
- ../:/opt | ||
ports: | ||
- $VERIFLIER_LOCAL_PORT:$VERIFLIER_DOCKER_PORT | ||
environment: | ||
- VERIFLIER_AUTH_TOKEN=$VERIFLIER_AUTH_TOKEN | ||
- VERIFLIER_PORT=$VERIFLIER_DOCKER_PORT | ||
- JETMON_PORT=$JETMON_DOCKER_PORT | ||
|
||
volumes: | ||
db: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
cd /jetmon | ||
|
||
mkdir -p logs | ||
touch logs/jetmon.log logs/status-change.log | ||
|
||
mkdir -p stats | ||
touch stats/sitespersec stats/sitesqueue stats/totals | ||
|
||
mkdir -p certs | ||
if [ ! -f certs/jetmon.key ] && [ ! -f certs/jetmon.crt ]; then | ||
openssl req -newkey rsa:2048 -nodes -keyout certs/jetmon.key -x509 -days 365 -out certs/jetmon.crt -subj "/C=US/ST=California/L=San Francisco/O=Automattic Inc./CN=jetmon" | ||
fi | ||
|
||
sed -e "s/<AUTH_TOKEN>/${WPCOM_JETMON_AUTH_TOKEN}/g" -e "s/<VERIFLIER_PORT>/${VERIFLIER_PORT}/g" -e "s/<VERIFLIER_AUTH_TOKEN>/${VERIFLIER_AUTH_TOKEN}/g" config/config-sample.json > config/config.json | ||
sed -e "s/<MYSQLDB_USER>/${MYSQLDB_USER}/g" -e "s/<MYSQLDB_ROOT_PASSWORD>/${MYSQLDB_ROOT_PASSWORD}/g" -e "s/<MYSQLDB_PORT>/${MYSQLDB_DOCKER_PORT}/g" -e "s/<MYSQLDB_DATABASE>/${MYSQLDB_DATABASE}/g" config/db-config-sample.conf > config/db-config.conf | ||
|
||
exec npm run rebuild-run |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
cd /opt/veriflier | ||
|
||
qmake | ||
make | ||
|
||
mkdir -p certs | ||
if [ ! -f certs/veriflier.key ] && [ ! -f certs/veriflier.crt ]; then | ||
openssl req -newkey rsa:2048 -nodes -keyout certs/veriflier.key -x509 -days 365 -out certs/veriflier.crt -subj "/C=US/ST=California/L=San Francisco/O=Automattic Inc./CN=jetmon" | ||
fi | ||
|
||
sed -e "s/<JETMON_PORT>/${JETMON_PORT}/g" -e "s/<VERIFLIER_PORT>/${VERIFLIER_PORT}/g" -e "s/<VERIFLIER_AUTH_TOKEN>/${VERIFLIER_AUTH_TOKEN}/g" config/veriflier-sample.json > config/veriflier.json | ||
|
||
exec ./veriflier start |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "jetmon", | ||
"version": "0.0.1", | ||
"description": "Parallel HTTP health monitoring using HEAD requests for large scale website monitoring.", | ||
"scripts": { | ||
"rebuild-run": "node-gyp rebuild && cp build/Release/jetmon.node lib && node lib/jetmon.js" | ||
}, | ||
"dependencies": { | ||
"log4js": "0.6.38", | ||
"mysql": "2.11.1" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.o | ||
*.cpp | ||
*.h | ||
.qmake.stash | ||
Makefile | ||
veriflier |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
veriflier.json | ||
|
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