Skip to content

Commit

Permalink
Merge branch 'master' of github.com:operepo/ope
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyrumple committed May 10, 2024
2 parents cf0bdbd + f277712 commit fe02e35
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 59 deletions.
11 changes: 10 additions & 1 deletion docker_build_files/down.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/sh

docker-compose down --remove-orphans
compose=`which docker-compose`

if [ -z "$compose" ]; then
compose="docker compose"
fi;
echo "Using Compose: $compose"



#docker-compose down --remove-orphans
$compose down --remove-orphans
12 changes: 11 additions & 1 deletion docker_build_files/fix_role_overrides_migration_error.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
# https://github.com/instructure/canvas-lms/issues/1806
# Then run this command to drop the index on that table, then the migration can finish.

docker-compose exec ope-postgresql bash -c "psql -U postgres -d canvas_production -c 'drop index index_role_overrides_on_context_role_permission;'"

compose=`which docker-compose`

if [ -z "$compose" ]; then
compose="docker compose"
fi;
echo "Using Compose: $compose"



$compose exec ope-postgresql bash -c "psql -U postgres -d canvas_production -c 'drop index index_role_overrides_on_context_role_permission;'"


10 changes: 9 additions & 1 deletion docker_build_files/flush_redis_keys.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash

docker-compose exec ope-redis sh -c "redis-cli flushdb"
compose=`which docker-compose`

if [ -z "$compose" ]; then
compose="docker compose"
fi;
echo "Using Compose: $compose"


$compose exec ope-redis sh -c "redis-cli flushdb"
# flushall clears ALL dbs.


13 changes: 7 additions & 6 deletions docker_build_files/ope-canvas-rce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM instructure/node-passenger:12
LABEL maintainer="Ray Pulsipher <[email protected]>"
LABEL description="Canvas LMS by Instructure - Image for Open Prison Education"
LABEL vendor="openprisoneducation.com"
LABEL version="1.2"
LABEL version="1.3"

USER root

Expand All @@ -16,15 +16,16 @@ LABEL rebuild=7
# Pull the RCE server
ENV RCE_APP_HOME /usr/src/rce/
WORKDIR $RCE_APP_HOME
ENV RCE_RELEASE master
#ENV RCE_RELEASE master
ENV RCE_RELEASE v1.21
RUN mkdir -p ${RCE_APP_HOME} \
&& cd ${RCE_APP_HOME} \
&& git init \
&& git remote add origin https://github.com/instructure/canvas-rce-api \
&& git fetch origin master --no-tags --depth 1 \
&& git checkout master \
#&& git fetch origin --no-tags --depth 1 refs/tags/${RCE_RELEASE}:refs/tags/${RCE_RELEASE} \
#&& git checkout ${RCE_RELEASE} \
#&& git fetch origin master --no-tags --depth 1 \
#&& git checkout master \
&& git fetch origin --no-tags --depth 1 refs/tags/${RCE_RELEASE}:refs/tags/${RCE_RELEASE} \
&& git checkout ${RCE_RELEASE} \
&& npm install --production \
&& echo Checkout done.

Expand Down
14 changes: 10 additions & 4 deletions docker_build_files/ope-canvas/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ ENV BUNDLER_VERSION 2.2.33
#ENV BUNDLER_VERSION 2.2.17


ENV CANVAS_RELEASE prod
#ENV CANVAS_RELEASE prod
ENV CANVAS_RELEASE release/2022-07-06.145
#ENV CANVAS_RELEASE release/2022-05-25.135
#ENV CANVAS_RELEASE release/2022-01-19.127
#ENV CANVAS_RELEASE release/2021-12-15.42
Expand Down Expand Up @@ -158,8 +159,8 @@ RUN cd ${APP_HOME} \
&& git config --global --add safe.directory ${APP_HOME} \
&& git init \
&& git remote add origin https://github.com/instructure/canvas-lms \
#&& git fetch origin --no-tags --depth 1 refs/tags/${CANVAS_RELEASE}:refs/tags/${CANVAS_RELEASE} \
&& git fetch --no-tags --depth 1 origin ${CANVAS_RELEASE} \
&& git fetch origin --no-tags --depth 1 refs/tags/${CANVAS_RELEASE}:refs/tags/${CANVAS_RELEASE} \
#&& git fetch --no-tags --depth 1 origin ${CANVAS_RELEASE} \
&& git checkout ${CANVAS_RELEASE}


Expand Down Expand Up @@ -193,7 +194,7 @@ RUN cd build/vendor \


# INSTALL QTIMigrationTool
RUN mkdir ${APP_HOME}/vendor \
RUN #mkdir ${APP_HOME}/vendor \
&& cd ${APP_HOME}/vendor \
&& git clone https://github.com/instructure/QTIMigrationTool.git QTIMigrationTool \
&& chmod +x QTIMigrationTool/migrate.py
Expand Down Expand Up @@ -376,6 +377,11 @@ RUN echo "Settings file permissions..." \
&& dos2unix /usr/src/*.sh


# Fix migration error where singleton column added too late
# https://groups.google.com/g/canvas-lms-users/c/pk6pzDb0-Gw
RUN mv /usr/src/app/db/migrate/20210812210129_add_singleton_column.rb \
/usr/src/app/db/migrate/20111111214311_add_singleton_column.rb


USER root

Expand Down
4 changes: 2 additions & 2 deletions docker_build_files/ope-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ LABEL rebuild=8
LABEL maintainer="Ray Pulsipher <[email protected]>"
LABEL description="Web Gateway for Open Prison Education - source files at https://github.com/operepo"
LABEL vendor="openprisoneducation.com"
LABEL version="0.8"
LABEL version="0.9"

ARG VERSION=dev

RUN apk add nano openssl


LABEL rebuild=139
LABEL rebuild=141
# public_certs moved under /usr/share/nginx/html
# Make public_certs folder so we can make it easy to grab crt file
#RUN mkdir -p /public_certs \
Expand Down
19 changes: 10 additions & 9 deletions docker_build_files/ope-gateway/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
{{ if .Address }}
{{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}}
{{ if and .Container.Node.ID .Address.HostPort }}
# {{ .Container.Node.Name }}/{{ .Container.Name }}
# {{ .Container.Node.Name }}/{{ .Container.Name }} .
server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }} max_fails=0;
{{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}}
{{ else if .Network }}
# {{ .Container.Name }}
# {{ .Container.Name }} ..
server {{ .Network.IP }}:{{ .Address.Port }} max_fails=0;
{{ end }}
{{ else if .Network }}
# {{ .Container.Name }}
# {{ .Container.Name }} ...
{{ if .Network.IP }}
server {{ .Network.IP }} max_fails=0 down;
{{ else }}
# ....
server 127.0.0.1 max_fails=0 down;
{{ end }}
{{ end }}
Expand Down Expand Up @@ -172,12 +173,12 @@ server {
}
{{ end }}

{{ if ne $canvas_host "<notset>" }}
upstream ope-canvas-rce {
# RCE Server
server ope-canvas-rce:3010;
}
{{ end }}
#{{ if ne $canvas_host "<notset>" }}
#upstream ope-canvas-rce {
# # RCE Server
# server ope-canvas-rce:3010;
#}
#{{ end }}

{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}

Expand Down
11 changes: 10 additions & 1 deletion docker_build_files/recompile_canvas_assets.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/bash

docker-compose exec ope-canvas bash -c "cd /usr/src/app; bundle exec rake canvas:compile_assets"

compose=`which docker-compose`

if [ -z "$compose" ]; then
compose="docker compose"
fi;
echo "Using Compose: $compose"


$compose exec ope-canvas bash -c "cd /usr/src/app; bundle exec rake canvas:compile_assets"


76 changes: 42 additions & 34 deletions docker_build_files/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,59 @@

PY3=`which python3`
PY2=`which python`
compose=`which docker-compose`

PY=$PY3

if [ -z "$PY" ]; then
echo Switching to py2
#echo Switching to py2
PY=$PY2
fi;

echo "Using Python: $PY"

if [ -z "$compose" ]; then
compose="docker compose"
fi;
echo "Using Compose: $compose"

SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")
ROOTDIR=$(dirname "$BASEDIR")

cd "$BASEDIR"

# Only run this stuff if fog is enabled
# Only run this stuff if fog is enabled and running in old opensuse OS
if [ -f ope-fog/.enabled ]; then

systemctl disable rpcbind
systemctl stop rpcbind

# change to force update/checkout after adjusting gitattribute linefeeds

# Need these loaded for tftp server to work
echo "Ensuring kernel modules are loaded..."
modprobe nf_conntrack_tftp
echo "nf_conntrack_tftp" > /etc/modules-load.d/nf_conntrack_tftp.conf
modprobe nf_nat_tftp
echo "nf_nat_tftp" > /etc/modules-load.d/nf_nat_tftp.conf
modprobe nf_conntrack_ftp
echo "nf_conntrack_ftp" > /etc/modules-load.d/nf_conntrack_ftp.conf
modprobe nf_conntrack_netbios_ns
echo "nf_conntrack_netbios_ns" > /etc/modules-load.d/nf_conntrack_netbios_ns.conf
modprobe nfs
echo "nfs" > /etc/modules-load.d/nfs.conf
modprobe nfsd
echo "nfsd" > /etc/modules-load.d/nfsd.conf
modprobe ipip
echo "ipip" > /etc/modules-load.d/ipip.conf


# Add some rules to track tftp traffic
#WLAN_IF=eth0
#iptables -A INPUT -i $WLAN_IF -p udp -m state --state ESTABLISHED,RELATED -j ACCEPT
#iptables -A INPUT -i $WLAN_IF -p udp --dport 69 -m state --state NEW -j ACCEPT

if /usr/bin/grep -q "SUSE" "/etc/os-release"; then
systemctl disable rpcbind
systemctl stop rpcbind

# change to force update/checkout after adjusting gitattribute linefeeds

# Need these loaded for tftp server to work
echo "Ensuring kernel modules are loaded..."
modprobe nf_conntrack_tftp
echo "nf_conntrack_tftp" > /etc/modules-load.d/nf_conntrack_tftp.conf
modprobe nf_nat_tftp
echo "nf_nat_tftp" > /etc/modules-load.d/nf_nat_tftp.conf
modprobe nf_conntrack_ftp
echo "nf_conntrack_ftp" > /etc/modules-load.d/nf_conntrack_ftp.conf
modprobe nf_conntrack_netbios_ns
echo "nf_conntrack_netbios_ns" > /etc/modules-load.d/nf_conntrack_netbios_ns.conf
modprobe nfs
echo "nfs" > /etc/modules-load.d/nfs.conf
modprobe nfsd
echo "nfsd" > /etc/modules-load.d/nfsd.conf
modprobe ipip
echo "ipip" > /etc/modules-load.d/ipip.conf


# Add some rules to track tftp traffic
#WLAN_IF=eth0
#iptables -A INPUT -i $WLAN_IF -p udp -m state --state ESTABLISHED,RELATED -j ACCEPT
#iptables -A INPUT -i $WLAN_IF -p udp --dport 69 -m state --state NEW -j ACCEPT
fi
fi


Expand All @@ -64,17 +69,20 @@ rebuild_param=""
if [ "$build_flag" = "auto" ]; then
rebuild_param="auto"
fi
echo "Rebuilding docker compose..."
#echo "Rebuilding docker compose..."
$PY $ROOTDIR/build_tools/rebuild_compose.py "$rebuild_param"

if [ "$build_flag" = "b" ]; then
echo "Building docker containers..."
docker-compose build
#docker-compose build
$compose build
fi

echo "Bringing up containers..."
# Bring up without rebuilding (in case container is out of date it will still start)
docker-compose up -d --no-build --remove-orphans
#docker-compose up -d --no-build --remove-orphans
$compose up -d --no-build --remove-orphans



#echo "Bringing up bridge for fog..."
Expand Down

0 comments on commit fe02e35

Please sign in to comment.