-
Notifications
You must be signed in to change notification settings - Fork 1
Dockerized APEX Workshop
- ssh client, recommended putty for Windows PC's.
- sftp client, recommended Filezilla for Windows PC's.
cd ~
-
With
sudo
edit the/etc/default/grub
file. Add or edit the GRUB_CMDLINE_LINUX line to add the following two key-value pairs:GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
-
Update GRUB.
$ sudo update-grub
-
Now lets do something fun, go to your OCI Console and push the Reboot button for your Virtual Machine.
-
Once your Virtual Machine is back online log into it again π.
$ sudo apt-get remove docker docker-engine docker.io
Itβs OK if apt-get reports that none of these packages are installed.
-
Update the
apt
Package Index.$ sudo apt-get update
-
Install packages to allow apt to use a repository over HTTPS.
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ git \ unzip \ software-properties-common
-
Add Dockerβs official GPG key.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify that you now have the key with the fingerprint
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
, by searching for the last 8 characters of the fingerprint.$ sudo apt-key fingerprint 0EBFCD88
Output should be like below:
pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = `9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88` uid Docker Release (CE deb) <[email protected]> sub 4096R/F273FCD8 2017-02-22
-
Set up the stable repository.
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
-
Update the apt package index.
$ sudo apt-get update
-
Install the latest version of Docker CE.
$ sudo apt-get install docker-ce
-
Add your user to the
docker
unix group.sudo usermod -aG docker ubuntu
NOTE: After your user to the
docker
unix group you will have to logout from the session and log back in.
-
Open in your browser https://edelivery.oracle.com and Sign In.
-
In the search box type
Oracle Database 12c Standard Edition 2
and click Search. -
From the list of results click on the link that says
DLP: Oracle Database 12c Standard Edition 2 12.2.0.1.0 (Oracle Database Standard Edition 2)
. -
Click on the cart icon right next to search bar.
-
Select only the item that says
Oracle Database 12.2.0.1.0
and under the Platform/Languages field selectLinux x86-x64
then click on the button Continue. -
Review and accept the terms and conditions then click on the button Continue.
-
Click on the link that says WGET Options placed on the top and/or bottom on the right side.
-
Click on the button Download .sh and save in local computer.
-
Upload the file
wget.sh
to your Virtual Machine. -
Make
wget.sh
executable.$ chmod +x wget.sh
-
Execute
wget.sh
.Very important you force the execution of
wget.sh
throughbash
by executing the command as below. Also once you run the command it could appear that nothing is happening since thewget.sh
command is downloading in the background, in order to monitor the download process you could open a secondssh
connection to the VM andtail -f
the log (See below under Secondssh
)Please note that the download process will take a couple minutes so be PATIENT π.
$ bash wget.sh
Second
ssh
connection:The
wget.sh
command will create a filewgetlog-<DATE AND TIME>.log
where it will log the progress of download.tail -f wgetlog-<DATE AND TIME>.log
-
Rename the downloaded file
V839960-01.zip
tolinuxx64_12201_database.zip
.$ mv V839960-01.zip linuxx64_12201_database.zip
NOTE: We know that the network might be sometimes slow so we temporary have made available the software via a public link and you can wget it directly from your VM. π
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/n--917neK4vHAX8vccdg-IkMmgRZ5Q77diIUIN6xHAk/n/vnasumner/b/apex-docker-files/o/linuxx64_12201_database.zip
- Open in your browser http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html.
- Review and accept the terms and conditions.
- Click on the Download link right next to where it says
Oracle Application Express 5.1.4 - All languages
. - Upload the file
apex_5.1.4.zip
to your Virtual Machine.
NOTE: We know that the network might be sometimes slow so we temporary have made available the software via a public link and you can wget it directly from your VM. π
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/cltQhKsnYcTF-Zkb3iSTbD3xHhIF8YTgQPD0Odax06c/n/vnasumner/b/apex-docker-files/o/apex_5.1.4.zip
- Open in your browser http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html.
- Review and accept the terms and conditions.
- Locate version
Oracle REST Data Services 18.1.1
- Click on the Download link right next to where it says
Oracle REST Data Services (8269e56d278f9bb87733a58d754a6f62)
. - Upload the file
ords.18.1.1.95.1251.zip
to your Virtual Machine.
NOTE: We know that the network might be sometimes slow so we temporary have made available the software via a public link and you can wget it directly from your VM. π
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/TPtEJ4hKDK9DqHTKnZYbAtJEYlMev28x6izNnDWUHMY/n/vnasumner/b/apex-docker-files/o/ords.18.1.1.95.1251.zip
-
Clone Oracle's docker repo
$ git clone https://github.com/oracle/docker-images.git
-
Clone a copy of our great repo π.
$ git clone https://github.com/viscosityna/docker-apex.git
-
Create a directory that will help us install APEX auto-magically π.
$ mkdir -p docker-apex/patches/apex
-
Clone a copy of our great repo π.
$ git clone https://github.com/viscosityna/docker-ords.git
-
Move the database software into the directory
docker-images/OracleDatabase/SingleInstance/dockerfiles/
$ mv linuxx64_12201_database.zip docker-images/OracleDatabase/SingleInstance/dockerfiles/12.2.0.1/
-
Let's build the base image.
Grab a cup of coffe this will take a few minutes βοΈ.
$ cd docker-images/OracleDatabase/SingleInstance/dockerfiles/ $ ./buildDockerImage.sh -v 12.2.0.1 -s
Once the build process is successful you should see a message as below:
... Successfully built <Image ID> Successfully tagged oracle/database:12.2.0.1-se2 ...
-
Lets go back to our home directory.
$ cd ~
-
Copy APEX software into the directory
docker-apex/patches/apex/
.$ cp apex_5.1.4.zip docker-apex/patches/apex/
-
Let's build the APEX image.
$ cd docker-apex/ $ docker build \ --build-arg oracle_db_version=12.2.0.1 \ --build-arg oracle_db_edition=se2 \ -t apex-db:latest .
Once the build process is successful you should see a message as below:
... Successfully built <Image ID> Successfully tagged apex-db:latest ...
-
Lets go back to our home director, once again π.
$ cd ~
-
Move ORDS software into the directory
docker-ords/
.$ mv ords.18.1.1.95.1251.zip docker-ords/
-
Let's build the ORDS image.
$ cd docker-ords/ $ docker build \ --build-arg tomcat_version=7.0.82 \ --build-arg jre_version=jre8 \ --build-arg ords_install_pkg=ords.18.1.1.95.1251.zip \ -t ords:latest .
Once the build process is successful you should see a message as below:
... Successfully built <Image ID> Successfully tagged ords:latest ...
-
Let's go to our home directory once again, it's the last time we promise π.
cd ~
-
Create a
docker
network so the APEX container and the ORDS container can find each other β€οΈ.$ docker network create net01
Once the crate network successful you should see a message as below:
<Network ID>
-
Start a
docker
container for APEX.$ docker run -d \ --network=net01 \ --name=apex \ -e ORACLE_PWD=super_secret \ -p 1521:1521 \ -p 5500:5500 \ -v /home/ubuntu/docker-apex/patches:/opt/oracle/patches \ apex-db:latest
Once the run container command is successful you should see a message as below:
<Container ID>
Below you can find a brief explanation of each parameter passed to
docker run
Parameter Description -d Indicates the command docker run
to run in "deatached" mode, so it won't take over the command line prompt.--network Indicates into which docker
network we want the container to run.--name The name of the container, we can use this name in any docker
command to interact with it.-e ORACLE_PWD= This let's us set an environment variable in the container before the startup routine starts. This is how we pass in the password we want for all Oracle users (SYSTEM, SYS, APEX_PUBLIC_USER, APEX_LISTENER, APEX_REST_PUBLIC_USER). You can set it to anything you want, just make note of it because you will need this when running our ords
container.-p Lets us map a port inside the container to a port in our host VM -v Lets us mount a path in our host VM into a volume in our container. You ONLY can mount volumes that are exposed in the docker
image.apex-db:latest This is the name of the image we built. -
Now let's monitor the container startup routine.
$ docker logs -f apex
Take a water break this will take a few minutes.
Once the container startup routine is successful you should see a message as below, at this point you can hit
Ctrl+C
to cancel thedocker logs -f
command:... ######################### DATABASE IS READY TO USE! ######################### ...
-
Unzip APEX software, we'll use this to reference the static files from our ORDS container.
$ unzip apex_5.1.4.zip $ mv apex apex-5.1.4
-
Start a
docker
container for ORDS.$ docker run -d \ --network=net01 \ --name=ords \ -p 8080:8080 \ -v /home/ubuntu/apex-5.1.4/images:/usr/local/tomcat/webapps/i \ ords:latest \ --db-host apex \ --db-port 1521 \ --db-service-name ORCLPDB1 \ --apex-pu-pass super_secret \ --apex-rest-pu-pass super_secret \ --apex-listener-pass super_secret
Once the run container command is successful you should see a message as below:
<Container ID>
Below you can find a brief explanation of each parameter passed to docker run:
Parameter Description -d Indicates the command docker run
to run in "deatached" mode, so it won't take over the command line prompt.--network Indicates into which docker
network we want the container to run.--name The name of the container, we can use this name in any docker
command to interact with it.-p Lets us map a port inside the container to a port in our host VM -v Lets us mount a path in our host VM into a volume in our container. You ONLY can mount volumes that are exposed in the docker
image.ords:latest This is the name of the image we built. --db-host This is how we pass configuration to ORDS for the database's host. Since both our containers are running in the same docker
network we can reference internally for them by the container name π.--db-port The port we mapped to our host VM for the apex
container's1521
port, most likely is1521
.--db-service-name The service name for our database, for our workshop it will be always ORCLPDB1
.--apex-pu-pass The password of the APEX_PUBLIC_USER
database username, use the password provided when running theapex
container in the parameter-e ORACLE_PWD=<password>
most likely it would besuper_secret
if you didn't change the command in this guide.--apex-rest-pu-pass The password for the APEX_REST_PULIC_USER
database username, use the password provided when running theapex
container in the parameter-e ORACLE_PWD=<password>
most likely it would besuper_secret
if you didn't change the command in this guide.--apex-listener-pass The password for the APEX_LISTENER
database username, use the password provided when running theapex
container in the parameter-e ORACLE_PWD=<password>
most likely it would besuper_secret
if you didn't change the command in this guide. -
Now let's monitor the container startup routine.
$ docker logs -f ords
Once the container startup routine is successful you should see a message as below, at this point you can hit
Ctrl+C
to cancel thedocker logs -f
command:... INFO: Server startup in <STARTUP TIME> ms ...
-
APEX is strict for his INTERNAL workspace ADMIN user's password, so we will have to do this one manually .... for now π.
On this step we will connect into the
apex
container viasqlplus
and will invoke the execution of a.sql
command that resides in a path also in the container.NOTE: Make sure you provide a password that at least has one UPPERCASE letter and one NUMBER and one special character for the
Admin's Password
prompt.$ docker exec -it apex sqlplus sys/super_secret@orclpdb1 as sysdba
Go through the prompts and provide values, when done providing information you can hit
Ctrl+D
or type inquit
to exit thesqlplus
session in the container and get back to your host terminal.SQL*Plus: Release 12.2.0.1.0 Production on Thu Apr 12 13:24:32 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production SQL> @/opt/oracle/scripts/setup/apex/apxchpwd.sql ================================================================================ This script can be used to change the password of an Application Express instance administrator. If the user does not yet exist, a user record will be created. ================================================================================ Enter the administrator's username [ADMIN] User "ADMIN" does not yet exist and will be created. Enter ADMIN's email [ADMIN] [email protected] Enter ADMIN's password [] Created instance administrator ADMIN. SQL>
Use the follow information to login into the APEX Instance Admin Console and create your first APEX workspace.
Field | Value |
---|---|
WORKSPACE | INTERNAL |
USER | ADMIN |
PASSWORD | Your super secure password. |