Skip to content

Gittower nm #8

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

Open
wants to merge 34 commits into
base: gittower
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
445870e
environment
Oct 3, 2023
bf8a6fd
New default env, and add missing args to gittower
Oct 4, 2023
84c8845
Fix up environments for stack w/ mongo
Oct 4, 2023
e977f28
add missing ARGS; correct DB entry
Oct 4, 2023
0261588
Put cron job echo in quotes (doesn't work for me otherwise)
Oct 4, 2023
64d8ce2
add notification echoes
Oct 4, 2023
09208d2
Change to alpine:latest because compose commands unsupported
Oct 4, 2023
737b10e
add missing args to website docker file
Oct 4, 2023
d39c5e5
fix profile sqlite mount
Oct 6, 2023
617dbe0
Configuration changes for bot
Oct 7, 2023
0f994df
Configuration tweaking
Oct 7, 2023
9bce404
correctly configure volumes and image analysis.
Oct 7, 2023
6aa33d5
Update configuration
Oct 7, 2023
abce455
Merge remote-tracking branch 'origin/gittower' into gittower-nm
Oct 8, 2023
9332410
Finish merging new env pattern
Oct 8, 2023
511f344
clean up volumes
Oct 8, 2023
86f6e52
Migrate everything into docker volumes
Oct 12, 2023
52b78f9
remove local-up db (unused)
Oct 27, 2023
4dd52a3
Update default env
Oct 29, 2023
a3c4719
Update docker file to install node 16 (in a less deprecated way)
Oct 29, 2023
22a0315
Update environment with new collection
Oct 29, 2023
78f845f
update docker file
Oct 29, 2023
7d070d0
change commented line back to original
Oct 29, 2023
3c71b69
Finalize new docker image
Oct 29, 2023
aafa1f5
Merge remote-tracking branch 'origin/master' into gittower-nm
Oct 29, 2023
3eed453
Correct the bot call
Dec 4, 2023
8535c87
Upgrade site platform to node 18
Apr 24, 2024
15c7e92
Merge branch 'master' into gittower-nm
Apr 24, 2024
6b60b9b
add set yarn version to website build
Apr 24, 2024
b7ed669
set default node version to 18
Apr 24, 2024
8d0b1a8
change site-server branch.
nmoschkin Sep 3, 2024
7e93059
restore to master for site-server merge.
Sep 10, 2024
4e6ccd1
Multidocker cleanup.
nmoschkin Jan 19, 2025
ae4f322
Merge branch 'master' into gittower-nm
nmoschkin Jan 19, 2025
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
data
.env
conf
conf
multidocker/conf
25 changes: 22 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,23 @@ RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10

RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
## begin node

## old node install commands

# RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
# RUN apt-get install -y nodejs

## new node install commands

ARG node_version=v18.20.2
RUN cd /opt \
&& curl -LO https://nodejs.org/dist/${node_version}/node-${node_version}-linux-x64.tar.xz \
&& tar xJf node-${node_version}-linux-x64.tar.xz \
&& rm node-${node_version}-linux-x64.tar.xz
ENV PATH=/opt/node-${node_version}-linux-x64/bin:${PATH}

## end node

WORKDIR /

Expand All @@ -49,6 +64,9 @@ COPY dataorig /dataorig/
# Clone repos
WORKDIR /
#RUN git clone https://github.com/stt-datacore/website.git #- run script should do this

# experimental and easy to revert

RUN git clone https://github.com/stt-datacore/cpp-image-analysis.git
RUN git clone https://github.com/stt-datacore/bot.git
RUN git clone https://github.com/stt-datacore/asset-server.git
Expand Down Expand Up @@ -95,6 +113,7 @@ RUN make -j$(nproc)
#RUN mv /asset-server/out/* /dataorig/asset-server/
#RUN rm -rf /asset-server/out
#RUN ln -s /data/asset-server /asset-server/out

RUN echo Node Version
RUN node --version
COPY ./runme.sh /runme.sh
ENTRYPOINT /runme.sh
31 changes: 29 additions & 2 deletions multidocker/.env.defaults
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
NODE_VERSION=16
NODE_VERSION=18
ALPINE_VERSION=3.17

WEBSITE_BRANCH=master
SERVER_BRANCH=master
ASSET_BRANCH=master
BOT_BRANCH=master
BUILD_TYPE=development
CPP_BRANCH=master

NGINX_CONF=development.conf
BUILD_TYPE=development

# PM2
PM2_INFO_URL=
PM2_ERROR_URL=

# Shared Assets
# ASSETS_DIR=/app/asset-server/build/out
# SQLITE_DB=/app/site-server/static/profiles.sqlite

# MongoDB Environment
MONGO_INITDB_DATABASE=user
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=secret

DB_CONNECTION_STRING=sqlite:/sqlite/datacore.db
MONGO_CONN_STRING=mongodb://admin:secret@datacoredb
MONGO_DB_NAME=datacore
MONGO_PROFILE_COLLECTION=playerProfiles
MONGO_TRACKED_VOYAGES_COLLECTION=trackedVoyages
MONGO_TRACKED_ASSIGNMENTS_COLLECTION=trackedAssignments
MONGO_TELEMETRY_VOYAGE_COLLECTION=telemetry
MONGO_FBB_SOLVES_COLLECTION=solves
MONGO_FBB_TRIALS_COLLECTION=trials
MONGO_FBB_COLLECTION=bossBattles
MONGO_DISCORD_USERS_COLLECTION=discordUsers
18 changes: 18 additions & 0 deletions multidocker/conf-defaults/bot.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Bot
BOT_TOKEN=
DATACORE_URL=https://datacore.app/
ASSETS_URL=https://assets.datacore.app/
NODE_ENV=production

IMAGE_ANALYSIS_URL=http://DCImageAnalysis:5000

PROFILE_DATA_PATH=/profiles/
DB_CONNECTION_STRING=sqlite:/sqlite/datacore.db
LOG_PATH=/data/logs/
DC_DATA_PATH=/sitebuild/structured
CONFIG_PATH=/data/bot_config.json

# ImgFlip
IMGFLIP_PASSWORD=
IMGFLIP_USERNAME=
3 changes: 3 additions & 0 deletions multidocker/conf-defaults/cpp-image-analysis.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CPP_TRAIN_PATH=/traindata/train/
CPP_DATA_PATH=/traindata/data/

1 change: 1 addition & 0 deletions multidocker/conf-defaults/rsync.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RSYNC_PASSWORD=insecure
7 changes: 7 additions & 0 deletions multidocker/conf-defaults/site-server.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Site Server Environment
STT_BOT_USERNAME=
STT_BOT_PASSWORD=
JWT_SECRET=
CORS_ORIGIN=https://datacore.app/
PROFILE_DATA_PATH=/profiles
LOG_PATH=/data/logs
3 changes: 3 additions & 0 deletions multidocker/conf-defaults/website.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Website Environment
GATSBY_DATACORE_URL=/
GATSBY_ASSETS_URL=/assets/
22 changes: 22 additions & 0 deletions multidocker/conf.defaults/bot.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# Bot
BOT_TOKEN=
DATACORE_URL=https://datacore.app/
ASSETS_URL=https://assets.datacore.app/
DEFAULT_GUILD=

# Seperate configuration for bot, because certain dev scenarios
# require that this be different
NODE_ENV=development

IMAGE_ANALYSIS_URL=http://DCImageAnalysis:5000

PROFILE_DATA_PATH=/profiles/
DB_CONNECTION_STRING=sqlite:/sqlite/datacore.db
LOG_PATH=/data/logs/
DC_DATA_PATH=/sitebuild/structured
CONFIG_PATH=/data/bot_config.json

# ImgFlip
IMGFLIP_PASSWORD=
IMGFLIP_USERNAME=
3 changes: 3 additions & 0 deletions multidocker/conf.defaults/cpp-image-analysis.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CPP_TRAIN_PATH=/traindata/train/
CPP_DATA_PATH=/traindata/data/

6 changes: 4 additions & 2 deletions multidocker/conf.defaults/site-server.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Site Server Environment
STT_BOT_USERNAME=
STT_BOT_PASSWORD=
JWT_SECRET=
DB_CONNECTION_STRING=sqlite://database
CORS_ORIGIN=https://datacore.app/
CORS_ORIGIN=https://datacore.app/
PROFILE_DATA_PATH=/profiles
LOG_PATH=/data/logs
4 changes: 2 additions & 2 deletions multidocker/conf.defaults/website.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Website Environment
GATSBY_DATACORE_URL=/
#GATSBY_ASSETS_URL=https://assets.datacore.app/
GATSBY_ASSETS_URL=/assets/
GATSBY_ASSETS_URL=/assets/
2 changes: 1 addition & 1 deletion multidocker/contexts/bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ COPY bot_config.json /data/
CMD npm run start

FROM development as production
CMD pm2-runtime --name server start npm -- start
CMD pm2-runtime --name bot start npm -- start
10 changes: 9 additions & 1 deletion multidocker/contexts/cpp-image-analysis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ ENV LANG=C.UTF-8
WORKDIR /usr/src/dcimageanalysis
COPY --from=source . .

WORKDIR /traindata
RUN mkdir train
RUN cp /usr/src/dcimageanalysis/data . -r

WORKDIR /usr/src/dcimageanalysis

RUN apk add --no-cache --virtual .build \
curl \
build-base \
pkgconfig \
cmake \
Expand Down Expand Up @@ -50,4 +57,5 @@ WORKDIR /usr/src/dcimageanalysis/build
CMD ./imserver

FROM development as production
CMD pm2-runtime start "./imserver --jsonpath=/website/public_web/structured/ --trainpath=/data/train/ --datapath=/cpp-image-analysis/data/ --asseturl=https://assets.datacore.app/" --name "imageAnalysis"

CMD pm2-runtime start "./imserver --jsonpath=/sitebuild/structured/ --trainpath=$CPP_TRAIN_PATH --datapath=$CPP_DATA_PATH --asseturl=$ASSETS_URL" --name "imageAnalysis"
7 changes: 4 additions & 3 deletions multidocker/contexts/gittower/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}
RUN apk add docker git bash
RUN echo */30 * * * * ./runjobs > crontab
# FROM alpine:${ALPINE_VERSION}
FROM alpine:latest
RUN apk add docker git bash docker-compose
RUN echo "*/5 * * * * /app/runjobs" > crontab
RUN crontab ./crontab
RUN mkdir /app
WORKDIR /app
Expand Down
1 change: 1 addition & 0 deletions multidocker/contexts/gittower/gittower
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
./setup-jobs
echo gittower waiting ...
crond -f -l 8
1 change: 1 addition & 0 deletions multidocker/contexts/gittower/runjobs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ do
git fetch
git status|grep "is behind" && reload ${dir##*/}
done
echo gittower waiting ...
3 changes: 2 additions & 1 deletion multidocker/contexts/gittower/setup-jobs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ BASE_URL=https://github.com/stt-datacore/

./watch website ${BASE_URL}website.git ${WEBSITE_BRANCH}
./watch site-server ${BASE_URL}site-server.git ${SERVER_BRANCH}
./watch asset-server ${BASE_URL}asset-server.git ${ASSET_BRANCH}
./watch asset-server ${BASE_URL}asset-server.git ${ASSET_BRANCH}
./watch bot ${BASE_URL}bot.git ${BOT_BRANCH}
31 changes: 31 additions & 0 deletions multidocker/contexts/nginx/local.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server {
listen 80;
client_max_body_size 100M;
#server_name datacore.local;

location / {
root /sitebuild;
expires 1h;
}

location /assets/ {
root /assets/;
access_log off;
expires max;
}

location /assets/data/ {
root /assets/data/;
expires 1h;
}

location /profiles/ {
root /profiles/;
expires 1h;
}

location /api/ {
proxy_pass http://DCSiteServer:4420;
expires -1;
}
}
8 changes: 4 additions & 4 deletions multidocker/contexts/pm2-discord/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
ARG ALPINE_VERSION
ARG NODE_VERSION
ARG PM2_ERROR_URL
ARG PM2_INFO_URL
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION}

RUN npm install pm2 -g
Expand All @@ -20,5 +18,7 @@ RUN pm2 set pm2-discord-webhook:stop true
RUN pm2 set pm2-discord-webhook:restart true

# Set destinations for webhooks (URLs sourced from env)
RUN pm2 set pm2-discord-webhook:webhook_url_logs ${PM2_INFO_URL}
RUN pm2 set pm2-discord-webhook:webhook_url_errors ${PM2_ERROR_URL}
ARG PM2_INFO_URL
RUN pm2 set pm2-discord-webhook:webhook_url_logs $PM2_INFO_URL
ARG PM2_ERROR_URL
RUN pm2 set pm2-discord-webhook:webhook_url_errors $PM2_ERROR_URL
2 changes: 1 addition & 1 deletion multidocker/contexts/site-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM datacore/pm2-discord as development
RUN apk add python3 build-base sqlite
RUN mkdir /app
WORKDIR /app
COPY --from=source package.json package-lock.json .
COPY --from=source package.json package-lock.json ./
RUN npm install
COPY --from=source . .
RUN npm run build
Expand Down
6 changes: 4 additions & 2 deletions multidocker/contexts/website/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
ARG NODE_VERSION
ARG ALPINE_VERSION
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION}
FROM node:$NODE_VERSION-alpine$ALPINE_VERSION
RUN apk add build-base python3 git rsync
WORKDIR /app
# Sentry requires the github sha
RUN git clone https://github.com/stt-datacore/website.git .git --bare --depth 1
COPY --from=source package.json yarn.lock ./
RUN yarn set version 3.6.3
RUN yarn install
RUN npx update-browserslist-db@latest
COPY --from=source . .
CMD yarn run build && rsync -ru --delete-after /app/public/ /sitebuild/ && sleep infinity

CMD yarn run build && rsync -ru --delete-after /app/public/ /sitebuild/
Binary file removed multidocker/datacore.db
Binary file not shown.
Loading
Loading