Skip to content

Commit

Permalink
removing oracle from docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorquas committed Aug 16, 2018
1 parent 8d9d0b5 commit 86f5120
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 378 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -62,6 +62,3 @@ buildconf/scripts/import_products.json

# Vagrant
.vagrant/

# don't want to push up the oracle binary by accident
*oracle-xe*.zip
13 changes: 3 additions & 10 deletions docker/README.mkd
Expand Up @@ -29,13 +29,8 @@ in order to stop and clean up existing running containers, as well as invoking t
options. This script will mount your current development checkout of candlepin (this repo) into `/candlepin-dev/`
and bring up a database at hostname `db` on the running container

NOTE: the oracle image has SELINUX issues. In order to overcome these, please install the included policy via
```bash
sudo semodule -i oraclecontainer.pp
```

By default the `test` script will run candlepin against a postgres database. You can change this behavior with the
`-o`, `-m`, or `-p` flags which will use oracle, mysql, or postgres respectively. To change the default permanently,
`-m` or `-p` flags which will use mysql or postgres respectively. To change the default permanently,
run the `switch-defaults` script.

To run multiple candlepin containers simultaneously, give each invocation of `test` a unique name with the `-n` flag.
Expand All @@ -46,8 +41,8 @@ Some useful invocations of the `test` command:
# run only unit tests
./test -c '/usr/bin/cp-test -u'

# screw tests, give me a shell and an oracle db
./test -o -c '/bin/bash'
# screw tests, give me a shell and a mysql db
./test -m -c '/bin/bash'

# run mysql and postgres tests at the same time
./test -m -n "my_mysql_tests"
Expand All @@ -72,5 +67,3 @@ be able to use an off the shelf solution for the databases. The advantages of th
* Only changes to the `docker/candlepin-base` or candlepin updates in brew (for the `docker/candlepin-rhel*` folders) would require a rebuild
* This saves tons of space on our build machines.

We will somewhat have to maintain the oracle DB as oracle does not allow any versions of oracle to be published publicly in a container.
We are, however, using their public scripts to build the container.
13 changes: 0 additions & 13 deletions docker/build-images
Expand Up @@ -3,7 +3,6 @@
unset CDPATH
SCRIPT_NAME=$( basename "$0" )
SCRIPT_HOME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
ORACLE_BINARY='oracle-xe-11.2.0-1.0.x86_64.rpm.zip'
CURRENT_DIR=$PWD

# defaults
Expand Down Expand Up @@ -66,17 +65,6 @@ get_image_names() {
python -c 'import yaml,sys;y=yaml.safe_load(sys.stdin); print " ".join(y["services"].keys())' < $SCRIPT_HOME/docker-compose-build.yml
}

# get oracle binary
update_oracle_binary() {
if [[ "${IMAGE:-$(get_image_names)}" =~ "oracle" ]]; then
cd $SCRIPT_HOME
if ( ! sha1sum -c oracle/oracle-xe.zip.sha1 ); then
wget -O $SCRIPT_HOME/oracle/$ORACLE_BINARY http://auto-services.usersys.redhat.com/rhsm/$ORACLE_BINARY
fi
cd -
fi
}

# tags a docker image with a version
tag_images() {
TAG_IMAGES=${IMAGE:-$(get_image_names)}
Expand All @@ -87,7 +75,6 @@ tag_images() {
}

echo "Building images..."
update_oracle_binary
cd $SCRIPT_HOME
docker-compose -f docker-compose-build.yml build $BUILD_ARGS $IMAGE && tag_images
evalrc $? "Build not successful."
Expand Down
19 changes: 1 addition & 18 deletions docker/candlepin-base/setup-db.sh
Expand Up @@ -38,28 +38,13 @@ setup_postgres() {
retry 20 "postgres" pg_isready -h db
}

test_oracle_connection() {
! ( (
sqlplus -s "sys/password@//$db_host/XE as sysdba"<<EOF
select 1 from dual;
EOF
) | grep -q ERROR )
}

setup_oracle() {
local db_host="${DBHOSTNAME:-localhost}"
retry 60 "oracle" test_oracle_connection
echo "USE_ORACLE=\"1\"" >> /root/.candlepinrc
}

setup_database() {
# normalize the flags with true/false
USING_MYSQL=${USING_MYSQL:-'false'}
USING_POSTGRES=${USING_POSTGRES:-'false'}
USING_ORACLE=${USING_ORACLE:-'false'}

# set a default
if [ $USING_MYSQL = false ] && [ $USING_POSTGRES = false ] && [ $USING_ORACLE = false ]; then
if [ $USING_MYSQL = false ] && [ $USING_POSTGRES = false ]; then
# mysql for now
USING_MYSQL=true
fi
Expand All @@ -68,7 +53,5 @@ setup_database() {
setup_mysql
elif [ $USING_POSTGRES = true ]; then
setup_postgres
elif [ $USING_ORACLE = true ]; then
setup_oracle
fi
}
15 changes: 0 additions & 15 deletions docker/candlepin-base/setup-devel-env.sh
Expand Up @@ -61,21 +61,6 @@ if [[ $(printf "$(psql --version | awk '{print $3}')\n9.3.0" | sort -V | head -1
rm -rf /root/postgres
fi

# set up oracle client tools
mkdir -p /root/oracle
curl http://auto-services.usersys.redhat.com/rhsm/oracle-11.2.0.4.0-1.tar.gz > /root/oracle/oracle.tar.gz
cd /root/oracle
tar xvf oracle.tar.gz
yum -y localinstall oracle-instantclient*.rpm
ojdbcdir='/root/.m2/repository/com/oracle/ojdbc6/11.2.0'
mkdir -p $ojdbcdir
mv -f ojdbc6.jar $ojdbcdir/ojdbc6-11.2.0.jar
cd -
ln -s /usr/lib/oracle/11.2/client64/bin/sqlplus /usr/local/bin/sqlplus
#export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH
echo 'export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH' >> /etc/profile.d/oracle_profile.sh
rm -rf /root/oracle

# Setup for autoconf:
mkdir /etc/candlepin
echo "# AUTOGENERATED" > /etc/candlepin/candlepin.conf
Expand Down
7 changes: 0 additions & 7 deletions docker/docker-compose-build.yml
Expand Up @@ -2,13 +2,6 @@
---
version: '2'
services:
oracle_db:
build: oracle/
image: ${REGISTRY}/oracle_db
environment:
ORACLE_SID: XE
ORACLE_PDB: ORCLPDB1
shm_size: 1G
candlepin-base:
build: candlepin-base/
image: ${REGISTRY}/candlepin-base
Expand Down
25 changes: 0 additions & 25 deletions docker/docker-compose-oracle.yml

This file was deleted.

83 changes: 0 additions & 83 deletions docker/oracle/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion docker/oracle/oracle-xe.zip.sha1

This file was deleted.

131 changes: 0 additions & 131 deletions docker/oracle/runOracle.sh

This file was deleted.

8 changes: 0 additions & 8 deletions docker/oracle/setPassword.sh

This file was deleted.

0 comments on commit 86f5120

Please sign in to comment.