-
Notifications
You must be signed in to change notification settings - Fork 46
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
Request: add Oracle DB support #128
Comments
Looking for a good example of adding support for a new db-type, found this commit b82d0ac (adding mariadb support). |
I was facing problems defining new database and new users. Looking at the container-entrypoint.sh from gvenzl/oracle-xe I reached to this pieces that works from CLI (what is expected to be used by the Creating database (
Creating a user to the default db (
Create user on the specific moodle db (
Manually, I created a container locally with this command:
Then, after being created, use the above commands inside Finally, as a connection testing I run:
|
So, I think there should be the 3 commands altogether as a result of the invokation of |
Finally, retried with moodlehq/moodle-db-oracle and it works on GHA. Maybe yesterday there was some networking problem or so when I tried. |
Shouldn't that be |
Yes, thanks, I tried that version. |
I'm facing this problem:
I cannot reach the point where this prefix is set up. |
One step further. PHP driver oci8 is not present. |
Hi @jpahullo,
or give https://github.com/marketplace/actions/setup-php-action#heavy_plus_sign-php-extension-support a try: - name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: oci8
env:
fail-fast: true HTH, |
Hi @scara ! It seems we "read" our minds. I was thinking exactly like that, or either from the ci process from moodle.org. Thanks for the info! Sure it will help! |
Other option is to build docker images with all dependencies and extensions included, like we did at https://hub.docker.com/r/sred/php-apache-oracle/tags?page=1&ordering=last_updated, so that image is already built, gaining in set up time and reducing total time cost of testing and deployment of testing environments (set up once, and reused any number of times) |
I tried the second options and at least for php 7.4 it works correctly. Now, I'm facing troubles autenticating the user. Trying putting credentials on the install command. |
I'm putting the credentials into the OracleDatabase.php class in order to simplify the set up of CI on GHA |
Hi @scara ! I created a patch for the tracker's issue. The {{$this->temptables}} from sql_generator.php can be null, so I think it must be checked if it is null, bypass it. I will try to run it locally and check if the error is reproduced, either installing Moodle, phpunit tables or behat tables. Thanks! |
Hi! I'm finding that local in my computer I cannot build the oracle db instance. I'm using the latest version of moodle-docker and the master branch from moodle. The logs of the container oracle db shows this:
And the checker shows again and again I'm using this settings:
And the containers shows this:
Any suggestion? |
Checked that I'm using the latest moodlehq/moodle-db-oracle image |
I stopped and removed all containers and built them again, with the same result. |
Entering to the oracle db container, I cannot login into db with the sqlplus, like |
Removing local docker image and trying again. I'm trying individual commands from startup.sh from moodlehq/moodle-db-oracle and they didn't work from command line inside the oracle container |
@jpahullo - I'm just confirming that Oracle with PHP7.4 tests do work locally using unmodified Moodle tools/source:
I agree with @scara - this doesn't seem like it should require any changes elsewhere, so the error is likely somewhere in the changes proposed here |
No success. Still failing. I open an issue on the moodlehq/moodle-db-oracle. |
Ups! Thanks for the info @paulholden. Incredible. If you do moodlehq/moodle-db-oracle-r2 latest cbccc731cb4a 7 months ago 2.1GB |
In addition, please, @paulholden, do you think you could provide us the logs for the Moodle installation for phpunit tests and behat tests? I think tests inside the moodle-plugin-ci would pass, but it fails because of that exception about invoking a method on null. I mean, the problem could appear only during the behat iinitialization or phpunit initialization of their db tables. Thanks in advance. |
Hi @jpahullo,
On my Docker Engine: $ docker pull moodlehq/moodle-db-oracle-r2
Using default tag: latest
latest: Pulling from moodlehq/moodle-db-oracle-r2
5667fdb72017: Pull complete
d83811f270d5: Pull complete
ee671aafb583: Pull complete
7fc152dfb3a6: Pull complete
51896e240a72: Pull complete
64e16b57ee0a: Pull complete
18e53bbb289b: Pull complete
Digest: sha256:dbcdb20e1919abb180235fd0d3d30998de58de116bdcaf955d2e169de2700dfb
Status: Downloaded newer image for moodlehq/moodle-db-oracle-r2:latest
docker.io/moodlehq/moodle-db-oracle-r2:latest
$ docker images | grep oracle
moodlehq/moodle-db-oracle-r2 latest cbccc731cb4a 7 months ago 2.1GB I'll give it a try on my side within this day. HTH, |
Hi @jpahullo, Click here to see the console output when running the Behat init on a fresh clone of
|
Hi @scara! Thanks for the info. It's very weird, really weird. I can see from your logs that it took just 2 "waits" for the oracle db being ready. I left it for half an hour and no result. And running the I'll try again for sure. I'll let you know. Thanks! Jordi |
I proceeded the way you did and I the errors persist: $ docker logs -f moodledocker_db_1
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
ERROR:
ORA-12547: TNS:lost contact
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
ERROR:
ORA-12547: TNS:lost contact
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
Shutting down Oracle Database 11g Express Edition instance.
Stopping Oracle Net Listener.
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
/usr/sbin/startup.sh: running /docker-entrypoint-initdb.d/01-moodle-user.sql
SQL*Plus: Release 11.2.0.2.0 Production on Fri Aug 13 10:50:28 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: Enter password:
ERROR:
ORA-12547: TNS:lost contact
Enter user-name:
No luck. |
I'll stop all containers, docker system prune -a and I'll try again |
I did it and still the error inside the oracle container startup.sh does not work: $ ./start-docker
+ source .env
++ MOODLE_DOCKER_WWWROOT=/home/jordi/SREd/moodle.org/moodle
++ MOODLE_DOCKER_WEB_PORT=8000
++ MOODLE_DOCKER_DB=oracle
++ MOODLE_DOCKER_PHP_VERSION=7.4
+ cut -d = -f1
+ read line
+ export MOODLE_DOCKER_WWWROOT
+ read line
+ export MOODLE_DOCKER_WEB_PORT
+ read line
+ export MOODLE_DOCKER_DB
+ read line
+ export MOODLE_DOCKER_PHP_VERSION
+ read line
+ ./bin/moodle-docker-compose up -d
Creating network "moodledocker_default" with the default driver
Pulling exttests (moodlehq/moodle-exttests:latest)...
latest: Pulling from moodlehq/moodle-exttests
000eee12ec04: Pull complete
8ae4f9fcfeea: Pull complete
60f22fbbd07a: Pull complete
ccc7a63ad75f: Pull complete
a2427b8dd6e7: Pull complete
91cac3b30184: Pull complete
d6e40015fc10: Pull complete
54695fdb10a7: Pull complete
500ca11be45f: Pull complete
86b2805859cf: Pull complete
c61685fa4f4f: Pull complete
0bf989f9dbbb: Pull complete
01848ea209b5: Pull complete
0f6a22a6d1b5: Pull complete
Digest: sha256:72be6bc970756127610cae7fc3e31d27a2a6041e02245cb1a2961f70ea5e58b8
Status: Downloaded newer image for moodlehq/moodle-exttests:latest
Pulling db (moodlehq/moodle-db-oracle-r2:latest)...
latest: Pulling from moodlehq/moodle-db-oracle-r2
5667fdb72017: Pull complete
d83811f270d5: Pull complete
ee671aafb583: Pull complete
7fc152dfb3a6: Pull complete
51896e240a72: Pull complete
64e16b57ee0a: Pull complete
18e53bbb289b: Pull complete
Digest: sha256:dbcdb20e1919abb180235fd0d3d30998de58de116bdcaf955d2e169de2700dfb
Status: Downloaded newer image for moodlehq/moodle-db-oracle-r2:latest
Pulling mailhog (mailhog/mailhog:latest)...
latest: Pulling from mailhog/mailhog
df20fa9351a1: Pull complete
ed8968b2872e: Pull complete
a92cc7c5fd73: Pull complete
f17c8f1adafb: Pull complete
03954754c53a: Pull complete
60493946972a: Pull complete
368ee3bc1dbb: Pull complete
Digest: sha256:8d76a3d4ffa32a3661311944007a415332c4bb855657f4f6c57996405c009bea
Status: Downloaded newer image for mailhog/mailhog:latest
Pulling webserver (moodlehq/moodle-php-apache:7.4)...
7.4: Pulling from moodlehq/moodle-php-apache
b4d181a07f80: Pull complete
78b85dd8f014: Pull complete
8589b26a90be: Pull complete
f5af5d641946: Pull complete
614ec6f0b8d6: Pull complete
12b28f3797fb: Pull complete
96bcb7d2e6b0: Pull complete
09a46dfaa772: Pull complete
1a85b508a14e: Pull complete
c6fd9c89235a: Pull complete
40b955b2d455: Pull complete
fda03b9af7e2: Pull complete
570ea029c915: Pull complete
33896b419cda: Pull complete
b636e10e0567: Pull complete
90453f2e1636: Pull complete
ec36ba073b30: Pull complete
b27170bafa1c: Pull complete
7277fa7a5dc2: Pull complete
Digest: sha256:cf5eab312ede190a30ea7ac87b776b33f925419089a43e5c1a7aa169d941be3a
Status: Downloaded newer image for moodlehq/moodle-php-apache:7.4
Pulling selenium (selenium/standalone-firefox:2.53.1)...
2.53.1: Pulling from selenium/standalone-firefox
cad964aed91d: Pull complete
3a80a22fea63: Pull complete
50de990d7957: Pull complete
61e032b8f2cb: Pull complete
9f03ce1741bf: Pull complete
23b84691f9a2: Pull complete
1f1667297256: Pull complete
e4bc09a9d3b6: Pull complete
47592bc70a93: Pull complete
719dfe03ca53: Pull complete
714f82dc9591: Pull complete
e5f5c0bcf29d: Pull complete
457e8ed4985d: Pull complete
b24566c33966: Pull complete
b73b2c7604a1: Pull complete
f0c6dda3bc97: Pull complete
6a19c85d6d4e: Pull complete
6926806ab6b4: Pull complete
Digest: sha256:3d6386d06633bb226e867b573e804105f0c50ea04ea649d08ab97d9a8c76c639
Creating moodledocker_exttests_1 ... done
Creating moodledocker_db_1 ... done
Creating moodledocker_mailhog_1 ... done
Creating moodledocker_mailhog_1 ...
Creating moodledocker_webserver_1 ... done
Creating moodledocker_webserver_1 ...
+ ./bin/moodle-docker-wait-for-db
Waiting for oracle to come up...
Waiting for oracle to come up...
Waiting for oracle to come up...
Waiting for oracle to come up...
Waiting for oracle to come up...
^C Then, in the oracle container: $ docker logs -f moodledocker_db_1
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
ERROR:
ORA-12547: TNS:lost contact
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
ERROR:
ORA-12547: TNS:lost contact
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
Shutting down Oracle Database 11g Express Edition instance.
Stopping Oracle Net Listener.
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
/usr/sbin/startup.sh: running /docker-entrypoint-initdb.d/01-moodle-user.sql
SQL*Plus: Release 11.2.0.2.0 Production on Fri Aug 13 11:14:18 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: Enter password:
ERROR:
ORA-12547: TNS:lost contact
Enter user-name:
I'm really sorry, but I cannot start an oracle container to continue with this issue. |
When I run the command detailed in the moodlehq/moodle-db-oracle, I still see the same error: $ docker run --name db0 -p 1521:1521 moodlehq/moodle-db-oracle-r2
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
ERROR:
ORA-12547: TNS:lost contact
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
ERROR:
ORA-12547: TNS:lost contact
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
Shutting down Oracle Database 11g Express Edition instance.
Stopping Oracle Net Listener.
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
/usr/sbin/startup.sh: running /docker-entrypoint-initdb.d/01-moodle-user.sql
SQL*Plus: Release 11.2.0.2.0 Production on Fri Aug 13 11:20:07 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: Enter password:
ERROR:
ORA-12547: TNS:lost contact
Enter user-name:
|
By the way, the script $ cat start-docker
#!/bin/bash -x
source .env
cut -d '=' -f1 < .env | while read line; do
export $line;
done
./bin/moodle-docker-compose up -d
./bin/moodle-docker-wait-for-db
echo "Moodle started!"
jpax360:/media/jordi/SREd/moodle.org/moodle-docker ⎇ master*
$ cat stop-docker
#!/bin/bash
source .env
cut -d '=' -f1 < .env | while read line; do
export $line;
done
./bin/moodle-docker-compose stop
echo "Moodle stopped!"
jpax360:/media/jordi/SREd/moodle.org/moodle-docker ⎇ master*
$ cat destroy-docker
#!/bin/bash
source .env
cut -d '=' -f1 < .env | while read line; do
export $line;
done
./bin/moodle-docker-compose down
echo "Moodle dockers destroyed!"
jpax360:/media/jordi/SREd/moodle.org/moodle-docker ⎇ master*
$ |
Hi @jpahullo, I'll admin I'm now lost in what it is you are trying to do/prove here Are you able to run tests on Oracle using standard/expected commands (e.g. the exact ones @scara & I have previously posted in comments to this thread) locally? Without any external tooling other than that provided by https://github.com/moodlehq/moodle-docker
The logs contained nothing out of the ordinary, they completed without fail and I was able to run tests immediately after |
Thanks @paulholden. Sorry if I'm not totally clear. You can build a local instance with moodle-docker using an oracle db without effort. However, I can't. I always see the logs from the oracle container I showed before. What I need is first:
Why I need to complete these 3 steps? Githbub actions shows a problem accessing a method on null during the behat tests initialization (i.e., the Moodle db tables for running behat tests), and then it stops. I provided a patch for it in core (lib/ddl/sql_generator.php), since that attribute can be null as stated in the phpdocs. However, @scara suggests that there is something on the behat initialitzation that produces such an error (accessing a method on null), and only on the behat initialization. So, in summary, I would like to reproduce the scenario locally, but I can't. Let me know if I explained badly by my side. |
I also tried the commands: docker run --name db0base -p 1521:1521 wnameless/oracle-xe-11g-r2
docker exec -it db0base bash
# sqlplus sys/oracle as sysdba
# And also the oracle 18 image:
docker run --name db0base -p 1521:1521 wnameless/oracle-xe-11g-r2:18.04
docker exec -it db0base bash
# sqlplus sys/oracle as sysdba and they both show me the same error: $ docker exec -it db0base bash
root@ed2086c3fab3:/# sqlplus system/oracle as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Fri Aug 13 11:52:05 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: ^[[A^C
root@ed2086c3fab3:/# sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Fri Aug 13 11:52:29 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: sys
Enter password:
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: ^C
root@ed2086c3fab3:/# exit
exit |
So, I do not know how to proceed right now. I cannot start an oracle db container, neither with the moodlehq/moodle-db-oracle nor with base docker image wnameless/oracle-xe-11g-r2. I'm just blocked, stucked. If you can make the tests we commented before (the 3 steps locally), it would be great. |
Hi @jpahullo, Mine:
HTH, |
Hi, as far as this is quite old and Oracle is being deprecated and will be removed in a couple of versions, I am going to close this now. Reference: https://moodle.org/mod/forum/discuss.php?d=456122 |
I checked the created issues and I didn't realize some issue is related to this, so I'm creating it.
As stated in Moodle Dev Telegram chat, It would be really useful to support Oracle (this issue) and mssql (issue #92).
I've tried adding Oracle support in one plugin and then checked that only mysql, pgsql and mariadb are supported db-types.
As I can see, I think it is necessary mainly to add an implementation class of any db-type under https://github.com/moodlehq/moodle-plugin-ci/tree/master/src/Installer/Database.
My original idea was to use the docker image for Oracle used under moodlehq/moodle-docker. However, Github Actions require public docker hub images (if I understand it correct) and it seems it isn't. So, I was trying another db image, gvenzl/oracle-xe (supporting 18c and 11 Oracle versions). I successfully managed to build the image, but then I realized moodle-plugin-ci does not support it.
My last trials can be found here. One example is this:
One really useful point of that oracle image is that is has a builtin checker for db being ready. It takes a bit of time however:
The important bits of the yml are the following:
This image requires non-empty passwords, so I needed to set up non-empty passwords on the ci installing:
The text was updated successfully, but these errors were encountered: