chore: cleanup of legacy scripts
This commit is contained in:
parent
be47b76128
commit
86a183ec21
|
@ -1,96 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.20
|
||||
program=${0##*/}
|
||||
progdir=${0%/*}
|
||||
if [ "$progdir" = "$program" ]; then progdir="."; fi
|
||||
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
||||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
if [[ $(uname) =~ CYGWIN.* ]]; then parent=$(echo "$parent" | sed -e 's/^\/cygdrive\/\(.\)/\1:/'); fi
|
||||
|
||||
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
$program - Build the datatracker docker images
|
||||
|
||||
SYNOPSIS
|
||||
$program [OPTIONS]
|
||||
|
||||
DESCRIPTION
|
||||
This script builds a Ubuntu-based docker image that has been
|
||||
set up with the dependencies needed to easily run the IETF
|
||||
datatracker in development mode. It uses docker/app.Dockerfile and
|
||||
db.Dockerfile; i.e., the Dockerfiles in the same directory as this script.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
grep -E '^\s+-[a-zA-Z])' "$0" | sed -E -e 's/\)[^#]+#/ /'
|
||||
cat <<EOF
|
||||
|
||||
AUTHOR
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
# Default values
|
||||
IMAGE=ietf/datatracker-environment
|
||||
TAG=$(basename "$(svn info "$parent" | grep ^URL | awk '{print $2}' | tr -d '\r')")
|
||||
LOCAL=1
|
||||
|
||||
# Option parsing
|
||||
shortopts=hut:V
|
||||
args=$(getopt -o$shortopts $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-u) LOCAL=0;; # Upload image to repository after build
|
||||
-t) TAG=$2; shift;; # Use this docker image tag
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# The program itself
|
||||
docker rmi -f $IMAGE:trunk 2>/dev/null || true
|
||||
docker build --progress plain -t "$IMAGE-app:$TAG" -f docker/app.Dockerfile .
|
||||
docker build --progress plain -t "$IMAGE-db:$TAG" -f docker/db.Dockerfile .
|
||||
docker tag "$(docker images -q $IMAGE-app | head -n 1)" $IMAGE-app:latest
|
||||
docker tag "$(docker images -q $IMAGE-db | head -n 1)" $IMAGE-db:latest
|
||||
if [ -z "$LOCAL" ]; then
|
||||
docker push $IMAGE-app:latest
|
||||
docker push "$IMAGE-app:$TAG"
|
||||
docker push $IMAGE-db:latest
|
||||
docker push "$IMAGE-db:$TAG"
|
||||
fi
|
|
@ -1,97 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.11
|
||||
program=${0##*/}
|
||||
progdir=${0%/*}
|
||||
if [ "$progdir" = "$program" ]; then progdir="."; fi
|
||||
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
||||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
if [[ $(uname) =~ CYGWIN.* ]]; then parent=$(echo "$parent" | sed -e 's/^\/cygdrive\/\(.\)/\1:/'); fi
|
||||
|
||||
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
$program - Make a tarball of the MySQL database files and upload it
|
||||
|
||||
SYNOPSIS
|
||||
$program [OPTIONS]
|
||||
|
||||
DESCRIPTION
|
||||
This script creates a compressed tarball from the MySQL database files
|
||||
on disk, and uploads it to the ietf datatracker developer area on
|
||||
www.ietf.org.
|
||||
|
||||
It is intended to be used with the docker datatracker environment, after
|
||||
you have set up the database with docker/setupdb, started the docker
|
||||
image with docker/run, and updated the database with docker/updatedb.
|
||||
|
||||
To use it, exit from the docker container, to make sure that mysqldb
|
||||
isn't running and all the files consistent and available for copy. Then
|
||||
run docker/$program outside the docker container. You need to have ssh
|
||||
access to www.ietf.org in order for the scp command to succeed.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
grep -E '^\s+-[a-zA-Z])' "$0" | sed -E -e 's/\)[^#]+#/ /'
|
||||
cat <<EOF
|
||||
|
||||
AUTHOR
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
# Option parsing
|
||||
shortopts=hV
|
||||
args=$(getopt -o$shortopts $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# The program itself
|
||||
if [ -e "/.dockerenv" -o -n "$(grep -s '/docker/' /proc/self/cgroup)" ]; then
|
||||
die "It looks as if you're running inside docker -- please quit docker first."
|
||||
fi
|
||||
|
||||
workdir=$(realpath $progdir/../data/mysql/..)
|
||||
echo "Working directory: $workdir"
|
||||
cd $workdir
|
||||
echo "Building tarfile ..."
|
||||
tar cjf ietf_utf8.bin.tar.bz2 mysql
|
||||
echo "Copying tarfile to ietfa.amsl.com ..."
|
||||
scp ietf_utf8.bin.tar.bz2 ietfa.amsl.com:/a/www/www6s/lib/dt/sprint/
|
|
@ -28,7 +28,6 @@ yarn build
|
|||
yarn legacy:build
|
||||
|
||||
# Copy config files if needed
|
||||
cp $WORKSPACEDIR/docker/configs/settings_mysqldb.py $WORKSPACEDIR/ietf/settings_mysqldb.py
|
||||
cp $WORKSPACEDIR/docker/configs/settings_postgresqldb.py $WORKSPACEDIR/ietf/settings_postgresqldb.py
|
||||
|
||||
if [ ! -f "$WORKSPACEDIR/ietf/settings_local.py" ]; then
|
||||
|
@ -65,10 +64,6 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# Recondition settings to make changing databases easier. (Remember that we may have developers starting with settings_local from earlier work)
|
||||
python docker/scripts/db-include-fix.py
|
||||
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/from ietf.settings_mysqldb import DATABASES/from ietf.settings_postgresqldb import DATABASES/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
|
||||
|
||||
# Create data directories
|
||||
|
||||
echo "Creating data directories..."
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
from pathlib import Path
|
||||
content = Path('/workspace/ietf/settings_local.py').read_text()
|
||||
newcontent = content.replace(
|
||||
"""DATABASES = {
|
||||
'default': {
|
||||
'HOST': 'db',
|
||||
'PORT': 3306,
|
||||
'NAME': 'ietf_utf8',
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'USER': 'django',
|
||||
'PASSWORD': 'RkTkDPFnKpko',
|
||||
'OPTIONS': {
|
||||
'sql_mode': 'STRICT_TRANS_TABLES',
|
||||
'init_command': 'SET storage_engine=InnoDB; SET names "utf8"',
|
||||
},
|
||||
},
|
||||
}""",
|
||||
"from ietf.settings_postgresqldb import DATABASES",
|
||||
).replace(
|
||||
"""DATABASES = {
|
||||
'default': {
|
||||
'HOST': 'pgdb',
|
||||
'PORT': 5432,
|
||||
'NAME': 'ietf',
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'USER': 'django',
|
||||
'PASSWORD': 'RkTkDPFnKpko',
|
||||
},
|
||||
}""",
|
||||
"from ietf.settings_postgresqldb import DATABASES",
|
||||
)
|
||||
with Path('/workspace/ietf/settings_local.py').open('w') as replacementfile:
|
||||
replacementfile.write(newcontent)
|
Loading…
Reference in a new issue