Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Commit

Permalink
Add support for oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
orf committed Oct 7, 2018
1 parent e9d8878 commit 85780dc
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 16 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ PYTHON_VERSION=3.5
POSTGRES_VERSION=9.6
DJANGO_PATH=django-src/
MYSQL_VERSION=8
ORACLE_VERSION=12.1.0.2
MARIADB_VERSION=10.3
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
.idea/
oracle/*.zip
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ RUN apt-get update \
libmemcached-dev \
build-essential \
mysql-client \
unzip \
libaio1 \
&& apt-get clean
RUN pip install --upgrade pip

Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,23 @@ Simply substitute `sqlite` for any supported database:

`docker-compose run mariadb [args]`

Note: The oracle image requires authentication and is rather large.
[See here on how to authenticate](https://docs.oracle.com/cd/E37670_01/E75728/html/oracle-registry-server.html)
And if you're a madman you can run all the tests for all databases in parallel:

`docker-compose run oracle`
`docker-compose up`

If you're a madman you can run all the tests for all databases in parallel:
#### Oracle

`docker-compose up`
As usual Oracle is a bit more complex to set up. You need to download the latest `instantclient` **zip file**
[from this page](https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html) and place it inside the
`./oracle` directory. Ensure only one `.zip` file is present.

The database image is quite large (several gigabytes) and takes a fairly long time to initialise (5-10 minutes).
Once it has initialised subsequent starts should be very quick. You may wish to run `docker-compose run oracle-db`
before running any tests to ensure it initialises correctly.

Once this is done execute:

`docker-compose run oracle`

### Utilities

Expand Down
18 changes: 15 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,24 @@ services:
environment:
- DJANGO_SETTINGS_MODULE=settings.test_oracle
- EXTRA_REQUIREMENTS=oracle.txt
volumes:
- ./oracle:/oracle
extends:
service: sqlite
depends_on:
- oracle-db
oracle-db:
condition: service_healthy
oracle-db:
image: container-registry.oracle.com/database/standard:${ORACLE_VERSION}
image: sath89/oracle-12c
volumes:
- oracle:/u01/app/oracle/
environment:
- WEB_CONSOLE=false
healthcheck:
test: echo "select * from v\xe;" | sqlplus -S sys/oracle as sysdba || exit 1
timeout: 3s
interval: 30s
retries: 30

docs:
volumes:
Expand All @@ -95,4 +107,4 @@ services:
volumes:
pip-cache:
packages:
npm:
oracle:
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ pip install -r tests/requirements/py3.txt
if [ -n "$EXTRA_REQUIREMENTS" ]; then
pip install -r tests/requirements/${EXTRA_REQUIREMENTS}
fi

if compgen -G "/oracle/*.zip" > /dev/null; then
mkdir -p /opt/oracle
unzip /oracle/*.zip -d /opt/oracle
echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf
ldconfig
fi

exec $@
Empty file added oracle/.gitkeep
Empty file.
12 changes: 6 additions & 6 deletions settings/test_oracle.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'oracle-db:1521/orcl',
'USER': 'oracle',
'PASSWORD': 'Oracle',
'NAME': 'oracle-db:1521/xe',
'USER': 'system',
'PASSWORD': 'oracle',
'TEST': {
'USER': 'default_test',
'TBLSPACE': 'default_test_tbls',
Expand All @@ -12,9 +12,9 @@
},
'other': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'oracle-db:1521/orcl',
'USER': 'oracle',
'PASSWORD': 'Oracle',
'NAME': 'oracle-db:1521/xe',
'USER': 'system',
'PASSWORD': 'oracle',
'TEST': {
'USER': 'other_test',
'TBLSPACE': 'other_test_tbls',
Expand Down

0 comments on commit 85780dc

Please sign in to comment.