forked from fuzziebrain/docker-apex-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickstart.sh
executable file
·85 lines (73 loc) · 2.47 KB
/
quickstart.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
##### Functions #####
function generate_password() {
# SC => special characters allowed
SC="_"
while
_password=$(openssl rand -base64 $(($RANDOM % 6 + 15)) | tr '[:punct:]' $SC)
[[
$(echo $_password | grep -o '['$SC']' | wc -l) -lt 2
|| $(echo $_password | grep -o '[0-9]' | wc -l) -lt 2
|| $(echo $_password | grep -o '[A-Z]' | wc -l) -lt 2
|| $(echo $_password | grep -o '[a-z]' | wc -l) -lt 2
]]
do true; done
echo $_password
}
##### Prompt for required variables #####
while
echo -n "Enter an email address for your APEX administrator (required): "
read APEX_ADMIN_EMAIL
[[ -z $APEX_ADMIN_EMAIL ]]
do true; done
echo -n "Container name (leave empty to have one generated for you): "
read CONTAINER_NAME
##### Create environment variables file. #####
ORACLE_PWD=$(generate_password)
[[ -z $CONTAINER_NAME ]] && CONTAINER_NAME=das-qs-$(date +%s)
ENV_FILE_NAME=$CONTAINER_NAME.env
##### Print out Oracle password #####
echo "##### Important Information #####"
echo "Your Docker container name is: $CONTAINER_NAME"
echo "Your password for the database and APEX internal workspace is: $ORACLE_PWD"
echo ""
while
echo "We are now ready to build the Docker image and deploy your container."
echo -n "Type \"Y\" to continue or CTRL-C to exit: "
read CONTINUE
[[ ! $CONTINUE =~ (Y|y) ]]
do true; done
cat << EOF > $ENV_FILE_NAME
ORACLE_SID=XE
ORACLE_PDB=XEPDB1
ORACLE_PWD=$ORACLE_PWD
APEX_ADMIN_PWD=$ORACLE_PWD
APEX_PUBLIC_USER_PWD=$ORACLE_PWD
APEX_LISTENER_PWD=$ORACLE_PWD
APEX_REST_PUBLIC_USER_PWD=$ORACLE_PWD
ORDS_PUBLIC_USER_PWD=$ORACLE_PWD
INSTALL_FILE_APEX=apex-latest.zip
INSTALL_FILE_ORDS=ords-latest.zip
INSTALL_FILE_JAVA=java17
DOCKER_ORDS_PORT=8080
DOCKER_EM_PORT=5500
DOCKER_DB_PORT=1521
DB_VERSION=21.3.0
DB_EDITION=xe
DOCKER_NETWORK_NAME=das_network
ALLOW_DB_PATCHING=N
OML4R_SUPPORT=N
REST_ENABLED_SQL=Y
RTU_ENABLED=N
SQLDEVWEB=Y
DATABASEAPI=Y
XE_USE_LOCAL_COPY=N
EOF
##### Download files #####
echo "##### Downloading latest binaries for APEX and ORDS #####"
curl https://download.oracle.com/otn_software/apex/apex-latest.zip --output files/apex-latest.zip
curl https://download.oracle.com/otn_software/java/ords/ords-latest.zip --output files/ords-latest.zip
echo "##### Running the build #####"
bash ./01-build.sh $ENV_FILE_NAME 2>&1 | tee 01-build.log
echo "##### Deploying the container #####"
bash ./02-run.sh ${CONTAINER_NAME} $ENV_FILE_NAME 2>&1 | tee 02-run.log