loading...

26/07/2023

Install Apex in Docker

Tested OS: Oracle Linux

# sudo apt update
# sudo yum install openssh-server git vim vsftpd curl

1. # git clone https://github.com/fuzziebrain/docker-apex-stack
or # git clone https://github.com/zafims/docker-apex-stack
[Optional Edit passwords in Docker-Apex.env]

2. ******* MUST Do this ***** Copy “jdk-8u331-linux-x64.tar.gz” to /root/docker-apex-stack/files/ *******

========================== Install Docker =================================

Step 1 : check the version of the OS
# cat /etc/os-release

Step 2 : Install yum-utils packages by using the below command
# yum install yum-utils

Step 3 : Add Docker Repository by using the below command
# yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo

Step 4 : Install Docker packages by using the below command
# yum install docker-ce docker-ce-cli

Step 5 : start the Docker services by using the below command
# systemctl start docker

Step 6 : Enable the Docker service by using the below command
# systemctl enable docker

Step 7 : check the Docker status by using the below command
# systemctl status docker

================================== or install yacht ==============

# docker volume create yacht

# docker run -d –restart unless-stopped -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock -v yacht:/config –name yacht selfhostedpro/yacht

Log in with the email: admin@yacht.local –Password: pass

================================================================================================================================

// 4. # docker login

5. cd docker-apex-stack/

6. sudo ./quickstart.sh

Enter an email address for your APEX administrator (required): engr.zafar@gmail.com
Container name (leave empty to have one generated for you): dockerapex

Press: Y

6.
##### Important Information #####
Your Docker container name is: dockerapex9
Your password for the database and APEX internal workspace is: YXukEb………….

We are now ready to build the Docker image and deploy your container.
Type “Y” to continue or CTRL-C to exit: y

=================Find Password================

imam@imamz:~/docker-apex-stack$ vi dockerapex.env
===================================================

7.

# systemctl enable docker.service

// For My container restarted in case that they crash or even after a reboot.

# docker run -dit –restart unless-stopped dockerapex

====================================================

Using the sample settings, the following are accessible:
Port Application URL
8080 APEX http://localhost:8080
ex. http://192.168.101.31:8080/
==============================================================

============ Create Database ==================================
// Get into the Apex
# docker exec -it d1a5628d6629 bash

# sqlplus / as sysdba

SQL> show con_name

CON_NAME
——————————
CDB$ROOT

SQL> alter session set container=XEPDB1;

SQL> create user ifdr container=current;

SQL> create user ifdr identified by zafims@123;
SQL> grant dba to ifdr identified by zafims@123;
SQL> grant all privileges to ifdr;

// SQL> ALTER USER ifdr identified by zafims@123;

GRANT CREATE SESSION TO ifdr;

GRANT CREATE TABLE TO ifdr;

GRANT CREATE PROCEDURE TO ifdr;

GRANT UNLIMITED TABLESPACE TO ifdr;

==========================================================

Apex Login:

Workspace: internal
Username: admin
Pass: 7z2dz……….

======================= Oracle SYS Login =========================

–> For — Service Name

Host: 192.169.101.31 Port: 1521
Database: XEPDB1 Service Name
UN: ifdr
Role: Normal
Pass: zafims@123

–> For — SID
Host: 192.169.101.31 Port: 1521
Database: XE SID
UN: SYS
Role: SYSDBA
Pass: 7z2dz………….

 =============================== 2nd way Apex ( Easy way) =======================

docker pull ennie/oracleapex-complete:latest

docker run -d -p 8989:8080 ennie/oracleapex-complete

http://192.168.199.182:8989/ords

====================================Start Docker manually / Restart Docker =============================

# docker ps -a
# docker images

# docker ps –filter “status=exited”

# docker start <Container ID>
//docker stop <Container ID>
//docker rm <Container ID>

// docker rm $(docker -a -q) [For delete all containers]
// docker rmi $(docker images -q) [For delete all images]

/* Install app inside the Docker container previleged mode
# docker exec -u=0 -it 34f0b48437df bash
bash-4.2# yum install -y vim
bash-4.2# yum install -y openjdk-14-jdk-headless

docker run -d –name centos7 –privileged=true centos:7 /usr/sbin/init

*/

// Run Apex in specific Port
# docker run -it -d -p 8080:80 –name dockerapex d1a5628d6629

// For restarted in case that they crash or even after a reboot.

# docker run -dit –restart unless-stopped dockerapex

// If you had an already running container that you wanted to change the restart policy
# docker update –restart unless-stopped dockerapex
or
# docker update –restart unless-stopped d1a5628d6629

// Get into the Apex
# docker exec -it d1a5628d6629 bash

// Run Apex Manually
# docker exec -it d1a5628d6629 bash
# cd /opt/oracle/product/ords
# java -jar . ords.war
java -jar ords.war

==================== Backup ====================

1. # docker ps -a
2. # sudo docker start a0a15e867255
3. # sudo docker commit -p a0a15e867255 dockerapex
4. # sudo docker save -o ~/dockerapex.tar dockerapex
=================== Restore =====================
COPY dockerapex.tar to # cd /root/
1. # sudo docker load -i ~/dockerapex.tar
2. # sudo docker images
3. # sudo docker run -it dockerapex:latest

================= Restore Oracle Apex in New Linux OS ===

1. Install Minimal Linux OS
2.

==========run this code Oracle SQL Developer ====================
# docker exec -it d1a5628d6629 bash

# sqlplus / as SYSDBA

ALTER SESSION SET “_ORACLE_SCRIPT” = TRUE;

CREATE USER admin IDENTIFIED BY admin;

GRANT CREATE SESSION TO admin;

GRANT CREATE TABLE TO admin;

GRANT CREATE PROCEDURE TO admin;

GRANT UNLIMITED TABLESPACE TO admin;

==========================================================================

Oracle Info:

ORACLE_SID=XE (SID)
ORACLE_PDB=XEPDB1 (Service Name)
ORACLE_PWD=23TPhBi………….. (Password)

Apex & ORDS info:

APEX_PUBLIC_USER_PWD=23TPhBiRe………..
APEX_LISTENER_PWD=23TPhBiRe…………
APEX_REST_PUBLIC_USER_PWD=23TPhBiRe………….
ORDS_PUBLIC_USER_PWD=23TPhBiRe………..

Ports:

DOCKER_ORDS_PORT=8080
DOCKER_EM_PORT=5500
DOCKER_DB_PORT=1521

================ run Oracle ==================

# sqlplus / as sysdba
select ords. installed_version from dual;
# su – oracle
# lsnrctl status;
# lsnrctl start;

cd /opt
cd oracle/
./runOracle.sh

================================================================

# docker volume create data_volume
# docker run -v data_volume:/var/lib/DockerApex DockerApex
# docker volume ls

Bind mount
#docker run –v /data/dockerapex1:/var/lib/dockerapex dockerapex
#docker run –mount type=bind,source=/data/dockerapex1,target=/var/lib/dockerapex1 dockerapex1

================ Docker Location =====================
# cd /var/lib/docker [Others]
// # /var/snap/docker/common/var-lib-docker/containers [for Ubuntu]
# find / -name swarm

1. Create user:

CREATE USER ORDS_PUBLIC_USER IDENTIFIED BY Fd5RtHg;

2. Install java

# yum -y install wget
# w!get https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar xvf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2/ /opt/jdk-17/

tee /etc/profile.d/jdk.sh <<EOF
export JAVA_HOME=/opt/jdk-17
export PATH=\$PATH:\$JAVA_HOME/bin
EOF

source /etc/profile.d/jdk.sh

java -version

echo -e ‘export PATH=”$PATH:/opt/oracle/product/ords/bin”‘ >> ~/.bash_profile

ex: yhNOV2f…..

yum install nginx
systemctl start nginx
systemctl enable nginx
systemctl status nginx

https://docs.actian.com/openroad/6.2/index.html#page/ServerRef/Install_Tomcat_for_Linux.htm
yum install tomcat
yum install tomcat-webapps tomcat-admin-webapps

Open the configuration file:
/usr/share/tomcat/conf/tomcat.conf
4.Add the following to JAVA_OPTS:
JAVA_OPTS=”-Djava.library.path=<$II_SYSTEM>/ingres/lib:<$II_SYSTEM>/ingres/mainwin/mw/lib-amd64_linux:<$II_SYSTEM>/ingres/mainwin/mw/lib-amd64_linux_optimized”

======== Reset password if forgotten ==============

–> When boot Press Shift Key
→ Advanced option for ubuntu
→ Ubuntu with Linux ( Recovery Mode)
–> Choose Root Drop to root shell prompt
–> Enter
–> ls /home
:imam
–> passwd imam
–> “Enter New password”
Or
passwd root
–> “Enter New password”

→ For writable user: mount -o remount,rw /
→ for checking user: cat /etc/passwd

======================  For Error  ==========================

https-://www.youtube.com/watch?v=pZ6Jam_0cyg

Error : “503 Service Unavailable” or “The connection pool named: |apex|| had the following error(s): ORA-28000: The account is locked.”

Reason

1. “APEX_PUBLIC_USER” is lock

a. Come to command prompt and press “Ctrl+C” to stop the “ORDS”

b. Open SQL Plus

c. Connect with “sys / as sysdba”

Enter Pass: <your pass>

d. Run this command for your satisfaction

SELECT username, account_status

FROM dba_users

WHERE username LIKE ‘APEX%’;

e. Run this command

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

ALTER USER APEX_PUBLIC_USER IDENTIFIED BY zafims@123 ACCOUNT UNLOCK;

ALTER USER APEX_LISTENER IDENTIFIED BY zafims@123 ACCOUNT UNLOCK;

ALTER USER APEX_REST_PUBLIC_USER IDENTIFIED BY zafims@123 ACCOUNT UNLOCK;

f. Remain in command prompt (C:\19c_21.2\ords) and type “java -jar ords.war” and 

when “Oracle REST Data Services initialized” appear use Oracle APEX, minimize command prompt do not close it.

========================= Backup and Restore =========================

https-://www.youtube.com/watch?v=ejXGGMcohAY

1. Run Script: SELECT ‘ALTER TABLE ‘||TABLE_NAME||’ ALLOCATE EXTENT;’ FROM USER_TABLES WHERE SEGMENT_CREATED =’NO’;

-> if you find any table unallocated then copy the table and run the command

2. Tools –> Database Export ->

-> Connection: Select User  -> Check OFF -> Show Schema-> Check ON -> Drops

Save as Payroll_DataBackup.sql

3. Goto Application 

ex: Application 101 –> Export/Import –> Save as: Payroll_Apex_Backup.sql

4. Enter to SQL Plus

Enter user-name: sys as sysdba

Pass: <Password>

SQL> grant dba to ifdr identified by zafims@123;

SQL> conn ifdr/<Password>

SQL> show user

SQL> select table_name from user_tables;

5. Login As: Apex admin

6. Create Workspace –> Workspace: ifdr; Reuse Existing: YES; Schema Name: ifdr   Authentication with admin user

7. Login : Workspace: ifdr user: admin pass: <Password>

8. SQL Workshop –> SQL Script –> Upload  -> Choose File –> Payroll_DataDBackup.sql –> run

9. Application Builder –> Import –> Payroll_Apex_Backup.sql

=========== How to change ADMIN password or Unlock Account==============

If your ADMIN users password is missing then login to the database as sys users and execute following script from your APEX folder

SQL> @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] << Here hit enter
User “ADMIN” exists.
Enter ADMIN’s email [info@erpstuff.com] << Here hit enter
Enter ADMIN’s password []
Changed password of instance administrator ADMIN. << Provide a new password

SQL> commit;

Now login as admin in INTERNAL workspace.

Another possibility is if your ADMIN account is locked then try the following,

BEGIN
apex_util.set_security_group_id(p_security_group_id => 10);
apex_util.unlock_account(p_user_name => ‘ADMIN’);
END;
/
COMMIT;

=================================================================
Note:
1. Soft : pCloud –> zafims.au –> linux –> apex
2. Exit from Container = Ctrl + C
3. Not Exit From Container = Ctrl + P + Q

Posted in DockerTaggs: