From 954ff162d549b42874ef1c1400b7055bc743c7bc Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Wed, 7 Oct 2020 11:56:46 +0100 Subject: [PATCH 01/81] Update Version Number --- CHANGELOG.md | 7 +++++++ README.md | 2 +- containers/docker/Dockerfile | 2 +- documentation/Installation.md | 2 +- okitweb/static/okit/js/okit_console.js | 4 ++-- okitweb/static/okit/json/release.json | 4 ++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c98a3b2a..70408d5b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Release Notes +## Version 0.13.0 +**Release Date**: 28th October 2020 +### Features + +### Bug Fixes + + ## Version 0.12.0 **Release Date**: 7th October 2020 ### Features diff --git a/README.md b/README.md index 6374437f2..4172b0476 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OCI Designer Toolkit [0.12.0](CHANGELOG.md#version-0.12.0) +# OCI Designer Toolkit [0.13.0](CHANGELOG.md#version-0.13.0) OCI designer toolKIT (OKIT) is a browser based tool that allows the user to [design](https://www.ateam-oracle.com/introduction-to-okit-the-oci-designer-toolkit), [deploy](https://www.ateam-oracle.com/introduction-to-okit-the-oci-designer-toolkit) and visualise ([introspect/query](https://www.ateam-oracle.com/the-oci-designer-toolkit-query-feature)) diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index d0f922a69..928d8a1be 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -5,7 +5,7 @@ FROM oraclelinux:7-slim LABEL "provider"="Oracle" \ "issues"="https://github.com/oracle/oci-designer-toolkit/issues" \ - "version"="0.12.0" \ + "version"="0.13.0" \ "description"="OKIT Web Server Container." \ "copyright"="Copyright (c) 2020, Oracle and/or its affiliates." SHELL ["/bin/bash", "-c"] diff --git a/documentation/Installation.md b/documentation/Installation.md index 746201f91..626efdec2 100644 --- a/documentation/Installation.md +++ b/documentation/Installation.md @@ -22,7 +22,7 @@ python modules are installed and in addition provide a simple flask server that ## Clone Repository Before the building either the Docker or Vagrant Images the project will need to be cloned, or downloaded, from the GitHub Repository (or downloaded). The master branch is always the latest Stable Release but previous releases can be found using -associated Release tag is in the format vX.Y.Z hence for the version 0.12.0 the Release tag will be **v0.12.0**. +associated Release tag is in the format vX.Y.Z hence for the version 0.13.0 the Release tag will be **v0.13.0**. The command shows how this can be cloned to the local machine. diff --git a/okitweb/static/okit/js/okit_console.js b/okitweb/static/okit/js/okit_console.js index 9b3feffa4..b5fb3de1a 100644 --- a/okitweb/static/okit/js/okit_console.js +++ b/okitweb/static/okit/js/okit_console.js @@ -4,8 +4,8 @@ */ console.info('Loaded Console Javascript'); -const okitVersion = '0.12.0'; -const okitReleaseDate = '7th October 2020'; +const okitVersion = '0.13.0'; +const okitReleaseDate = '28th October 2020'; // Validation const validate_error_colour = "#ff4d4d"; const validate_warning_colour = "#ffd633"; diff --git a/okitweb/static/okit/json/release.json b/okitweb/static/okit/json/release.json index f85e87baf..a4322c4bb 100644 --- a/okitweb/static/okit/json/release.json +++ b/okitweb/static/okit/json/release.json @@ -1,4 +1,4 @@ { - "release": "0.12.0", - "tag": "v0.12.0" + "release": "0.13.0", + "tag": "v0.13.0" } \ No newline at end of file From 9c34926cb3eb317798f7dc80daa3a45ef6fb0048 Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Thu, 8 Oct 2020 12:15:29 +0100 Subject: [PATCH 02/81] Cloud init for building OCI Instance --- containers/cloud/cloud_init.yml | 126 ++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 containers/cloud/cloud_init.yml diff --git a/containers/cloud/cloud_init.yml b/containers/cloud/cloud_init.yml new file mode 100644 index 000000000..bf7c76248 --- /dev/null +++ b/containers/cloud/cloud_init.yml @@ -0,0 +1,126 @@ +#cloud-config +packages: + - git + +write_files: + # Add aliases to bash (Note: At time of writing the append flag does not appear to be working) + - path: /etc/.bashrc + append: true + content: | + alias lh='ls -lash' + alias lt='ls -last' + alias env='/usr/bin/env | sort' + # Create empty config + - path: /root/config + permissions: '0644' + content: | + [DEFAULT] + user= + fingerprint= + key_file= + tenancy=ocid1.tenancy.oc1..aaaaaaaaa3qmjxr43tjexx75r6gwk6vjw22ermohbw2vbxyhczksgjir7xdq + region=us-phoenix-1 + # Create Flask Service File + - path: /etc/systemd/system/flask.service + permissions: '644' + content: | + # Copyright (c) 2020, Oracle and/or its affiliates. + # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + + [Unit] + Description=Flask daemon + After=network.target + + [Service] + Type=simple + # the specific user that our service will run as + User=root + Group=root + Environment="PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" + Environment="PYTHONPATH=:/okit/visualiser:/okit/okitweb:/okit" + Environment="FLASK_APP=okitweb" + Environment="FLASK_DEBUG=development" + RuntimeDirectory=flask + WorkingDirectory=/okit/workspace + ExecStart=/usr/bin/python3 -m flask run --host=0.0.0.0 --port=8080 --no-debugger + ExecReload=/bin/kill -s HUP $MAINPID + KillMode=mixed + TimeoutStopSec=5 + TimeoutStartSec=300 + PrivateTmp=true + Restart=always + + [Install] + WantedBy=multi-user.target + # Create GUnicorn Service File + - path: /etc/systemd/system/gunicorn.service + permissions: '644' + content: | + # Copyright (c) 2020, Oracle and/or its affiliates. + # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + + [Unit] + Description=gunicorn daemon + Requires=gunicorn.socket + After=network.target + + [Service] + Type=simple + # the specific user that our service will run as + User=root + Group=root + Environment="PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" + Environment="PYTHONPATH=:/okit/visualiser:/okit/okitweb:/okit" + RuntimeDirectory=gunicorn + WorkingDirectory=/okit/workspace + ExecStart=/usr/local/bin/gunicorn okitweb.wsgi:app + ExecReload=/bin/kill -s HUP $MAINPID + KillMode=mixed + TimeoutStopSec=5 + TimeoutStartSec=300 + PrivateTmp=true + + [Install] + WantedBy=multi-user.target + # Create GUnicorn Socket File + - path: /etc/systemd/system/gunicorn.socket + permissions: '644' + content: | + # Copyright (c) 2020, Oracle and/or its affiliates. + # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + + [Unit] + Description=gunicorn socket + + [Socket] + ListenStream=/var/run/gunicorn.sock + # Our service won't need permissions for the socket, since it + # inherits the file descriptor by socket activation + # only the nginx daemon will need access to the socket + User=nginx + # Optionally restrict the socket permissions even more. + # Mode=600 + + [Install] + WantedBy=sockets.target + +runcmd: + # Clone OKIT + - sudo git clone --depth 1 https://github.com/oracle/oci-designer-toolkit.git / + - sudo ln -s /oci-designer-toolkit /okit + - sudo mkdir /okit/log + # Set Firewall Rules + - sudo firewall-offline-cmd --add-port=80/tcp + - sudo systemctl restart firewalld + # Add additional environment information because append does not appear to work in write_file + - sudo bash -c "echo 'source /etc/.bashrc' >> /etc/bashrc" + # Enable Flask Service + - sudo systemctl enable flask.service + - sudo systemctl start flask.service + # Enable Gunicorn Service + - sudo systemctl enable gunicorn.socket + - sudo systemctl start gunicorn.socket + - sudo systemctl enable gunicorn.service + - sudo systemctl start gunicorn.service + +final_message: "**** The system is finally up, after $UPTIME seconds ****" From ae11ebb2462fb2880a695352d1e3f45a3322a7f1 Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Thu, 8 Oct 2020 15:41:24 +0100 Subject: [PATCH 03/81] Add pip modules --- containers/cloud/cloud_init.yml | 104 ++++---------------------------- 1 file changed, 13 insertions(+), 91 deletions(-) diff --git a/containers/cloud/cloud_init.yml b/containers/cloud/cloud_init.yml index bf7c76248..a0ec1ca68 100644 --- a/containers/cloud/cloud_init.yml +++ b/containers/cloud/cloud_init.yml @@ -11,7 +11,7 @@ write_files: alias lt='ls -last' alias env='/usr/bin/env | sort' # Create empty config - - path: /root/config + - path: /root/.oci/config permissions: '0644' content: | [DEFAULT] @@ -20,106 +20,28 @@ write_files: key_file= tenancy=ocid1.tenancy.oc1..aaaaaaaaa3qmjxr43tjexx75r6gwk6vjw22ermohbw2vbxyhczksgjir7xdq region=us-phoenix-1 - # Create Flask Service File - - path: /etc/systemd/system/flask.service - permissions: '644' - content: | - # Copyright (c) 2020, Oracle and/or its affiliates. - # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - - [Unit] - Description=Flask daemon - After=network.target - - [Service] - Type=simple - # the specific user that our service will run as - User=root - Group=root - Environment="PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" - Environment="PYTHONPATH=:/okit/visualiser:/okit/okitweb:/okit" - Environment="FLASK_APP=okitweb" - Environment="FLASK_DEBUG=development" - RuntimeDirectory=flask - WorkingDirectory=/okit/workspace - ExecStart=/usr/bin/python3 -m flask run --host=0.0.0.0 --port=8080 --no-debugger - ExecReload=/bin/kill -s HUP $MAINPID - KillMode=mixed - TimeoutStopSec=5 - TimeoutStartSec=300 - PrivateTmp=true - Restart=always - - [Install] - WantedBy=multi-user.target - # Create GUnicorn Service File - - path: /etc/systemd/system/gunicorn.service - permissions: '644' - content: | - # Copyright (c) 2020, Oracle and/or its affiliates. - # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - - [Unit] - Description=gunicorn daemon - Requires=gunicorn.socket - After=network.target - - [Service] - Type=simple - # the specific user that our service will run as - User=root - Group=root - Environment="PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" - Environment="PYTHONPATH=:/okit/visualiser:/okit/okitweb:/okit" - RuntimeDirectory=gunicorn - WorkingDirectory=/okit/workspace - ExecStart=/usr/local/bin/gunicorn okitweb.wsgi:app - ExecReload=/bin/kill -s HUP $MAINPID - KillMode=mixed - TimeoutStopSec=5 - TimeoutStartSec=300 - PrivateTmp=true - - [Install] - WantedBy=multi-user.target - # Create GUnicorn Socket File - - path: /etc/systemd/system/gunicorn.socket - permissions: '644' - content: | - # Copyright (c) 2020, Oracle and/or its affiliates. - # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - - [Unit] - Description=gunicorn socket - - [Socket] - ListenStream=/var/run/gunicorn.sock - # Our service won't need permissions for the socket, since it - # inherits the file descriptor by socket activation - # only the nginx daemon will need access to the socket - User=nginx - # Optionally restrict the socket permissions even more. - # Mode=600 - - [Install] - WantedBy=sockets.target runcmd: + # Install Required Python Modules + - pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci=2.22.0 pyyaml==5.2 # Clone OKIT - - sudo git clone --depth 1 https://github.com/oracle/oci-designer-toolkit.git / - - sudo ln -s /oci-designer-toolkit /okit - - sudo mkdir /okit/log + - sudo bash -c "git clone --depth 1 https://github.com/oracle/oci-designer-toolkit.git /okit" + - sudo bash -c "mkdir /okit/{log,workspace}" # Set Firewall Rules - sudo firewall-offline-cmd --add-port=80/tcp - sudo systemctl restart firewalld # Add additional environment information because append does not appear to work in write_file - sudo bash -c "echo 'source /etc/.bashrc' >> /etc/bashrc" + # Copy Flask / GUnicorn Service Files + - sudo cp /okit/containers/services/flask.service /etc/systemd/system/flask.service + - sudo cp /okit/containers/services/gunicorn.service /etc/systemd/system/gunicorn.service + - sudo cp /okit/containers/services/gunicorn.socket /etc/systemd/system/gunicorn.socket # Enable Flask Service - - sudo systemctl enable flask.service - - sudo systemctl start flask.service + #- sudo systemctl enable flask.service + #- sudo systemctl start flask.service # Enable Gunicorn Service - - sudo systemctl enable gunicorn.socket - - sudo systemctl start gunicorn.socket + #- sudo systemctl enable gunicorn.socket + #- sudo systemctl start gunicorn.socket - sudo systemctl enable gunicorn.service - sudo systemctl start gunicorn.service From 311ec45807dcfa70cfe992f99e2535d2b33c8bd4 Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Thu, 8 Oct 2020 15:43:16 +0100 Subject: [PATCH 04/81] Cloud Init for installing OCI Instance --- containers/cloud/cloud_init.yml | 9 +-------- containers/services/flask.service | 28 ++++++++++++++++++++++++++++ containers/services/gunicorn.service | 27 +++++++++++++++++++++++++++ containers/services/gunicorn.socket | 17 +++++++++++++++++ 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 containers/services/flask.service create mode 100644 containers/services/gunicorn.service create mode 100644 containers/services/gunicorn.socket diff --git a/containers/cloud/cloud_init.yml b/containers/cloud/cloud_init.yml index a0ec1ca68..06d32428c 100644 --- a/containers/cloud/cloud_init.yml +++ b/containers/cloud/cloud_init.yml @@ -32,16 +32,9 @@ runcmd: - sudo systemctl restart firewalld # Add additional environment information because append does not appear to work in write_file - sudo bash -c "echo 'source /etc/.bashrc' >> /etc/bashrc" - # Copy Flask / GUnicorn Service Files - - sudo cp /okit/containers/services/flask.service /etc/systemd/system/flask.service + # Copy GUnicorn Service File - sudo cp /okit/containers/services/gunicorn.service /etc/systemd/system/gunicorn.service - - sudo cp /okit/containers/services/gunicorn.socket /etc/systemd/system/gunicorn.socket - # Enable Flask Service - #- sudo systemctl enable flask.service - #- sudo systemctl start flask.service # Enable Gunicorn Service - #- sudo systemctl enable gunicorn.socket - #- sudo systemctl start gunicorn.socket - sudo systemctl enable gunicorn.service - sudo systemctl start gunicorn.service diff --git a/containers/services/flask.service b/containers/services/flask.service new file mode 100644 index 000000000..793fd68b3 --- /dev/null +++ b/containers/services/flask.service @@ -0,0 +1,28 @@ +# Copyright (c) 2020, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +[Unit] +Description=Flask daemon +After=network.target + +[Service] +Type=simple +# the specific user that our service will run as +User=root +Group=root +Environment="PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" +Environment="PYTHONPATH=:/okit/visualiser:/okit/okitweb:/okit" +Environment="FLASK_APP=okitweb" +Environment="FLASK_DEBUG=development" +RuntimeDirectory=flask +WorkingDirectory=/okit/workspace +ExecStart=/usr/bin/python3 -m flask run --host=0.0.0.0 --port=8080 --no-debugger +ExecReload=/bin/kill -s HUP $MAINPID +KillMode=mixed +TimeoutStopSec=5 +TimeoutStartSec=300 +PrivateTmp=true +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/containers/services/gunicorn.service b/containers/services/gunicorn.service new file mode 100644 index 000000000..4e177bf12 --- /dev/null +++ b/containers/services/gunicorn.service @@ -0,0 +1,27 @@ +# Copyright (c) 2020, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +[Unit] +Description=gunicorn daemon +Requires=gunicorn.socket +After=network.target + +[Service] +Type=simple +# the specific user that our service will run as +User=root +Group=root +Environment="PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" +Environment="PYTHONPATH=:/okit/visualiser:/okit/okitweb:/okit" +Environment="OCI_CLI_AUTH=instance_principal" +RuntimeDirectory=gunicorn +WorkingDirectory=/okit/workspace +ExecStart=/usr/local/bin/gunicorn --workers=4 --limit-request-line 0 --timeout 120 --bind=0.0.0.0:80 okitweb.wsgi:app +ExecReload=/bin/kill -s HUP $MAINPID +KillMode=mixed +TimeoutStopSec=5 +TimeoutStartSec=300 +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/containers/services/gunicorn.socket b/containers/services/gunicorn.socket new file mode 100644 index 000000000..ca26aa60f --- /dev/null +++ b/containers/services/gunicorn.socket @@ -0,0 +1,17 @@ +# Copyright (c) 2020, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +[Unit] +Description=gunicorn socket + +[Socket] +ListenStream=/var/run/gunicorn.sock +# Our service won't need permissions for the socket, since it +# inherits the file descriptor by socket activation +# only the nginx daemon will need access to the socket +User=nginx +# Optionally restrict the socket permissions even more. +# Mode=600 + +[Install] +WantedBy=sockets.target From 81589a1a3ecae80ecc9a6c0f8acb0c2f878d90be Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Thu, 8 Oct 2020 16:24:45 +0100 Subject: [PATCH 05/81] Remove Socket Requirement --- containers/cloud/cloud_init.yml | 4 ++-- containers/services/gunicorn.service | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/containers/cloud/cloud_init.yml b/containers/cloud/cloud_init.yml index 06d32428c..f25cf2219 100644 --- a/containers/cloud/cloud_init.yml +++ b/containers/cloud/cloud_init.yml @@ -23,9 +23,9 @@ write_files: runcmd: # Install Required Python Modules - - pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci=2.22.0 pyyaml==5.2 + - sudo bash -c "pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci==2.22.0 pyyaml==5.2" # Clone OKIT - - sudo bash -c "git clone --depth 1 https://github.com/oracle/oci-designer-toolkit.git /okit" + - sudo bash -c "git clone -b toxophilist/sprint-11 --depth 1 https://github.com/oracle/oci-designer-toolkit.git /okit" - sudo bash -c "mkdir /okit/{log,workspace}" # Set Firewall Rules - sudo firewall-offline-cmd --add-port=80/tcp diff --git a/containers/services/gunicorn.service b/containers/services/gunicorn.service index 4e177bf12..c5828cb74 100644 --- a/containers/services/gunicorn.service +++ b/containers/services/gunicorn.service @@ -3,7 +3,7 @@ [Unit] Description=gunicorn daemon -Requires=gunicorn.socket +#Requires=gunicorn.socket After=network.target [Service] From 5201e3e451c3c55ab6b65a6650abbd59e91184be Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Fri, 9 Oct 2020 15:09:13 +0100 Subject: [PATCH 06/81] Add requests & pandas python libraries --- containers/cloud/cloud_init.yml | 4 ++-- containers/docker/Dockerfile | 4 +++- containers/vagrant/configure_software.sh | 18 ++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/containers/cloud/cloud_init.yml b/containers/cloud/cloud_init.yml index f25cf2219..39f2a2e42 100644 --- a/containers/cloud/cloud_init.yml +++ b/containers/cloud/cloud_init.yml @@ -23,7 +23,7 @@ write_files: runcmd: # Install Required Python Modules - - sudo bash -c "pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci==2.22.0 pyyaml==5.2" + - sudo bash -c "pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci==2.22.0 pandas==1.1.2 pyyaml==5.2 requests==2.24.0" # Clone OKIT - sudo bash -c "git clone -b toxophilist/sprint-11 --depth 1 https://github.com/oracle/oci-designer-toolkit.git /okit" - sudo bash -c "mkdir /okit/{log,workspace}" @@ -33,7 +33,7 @@ runcmd: # Add additional environment information because append does not appear to work in write_file - sudo bash -c "echo 'source /etc/.bashrc' >> /etc/bashrc" # Copy GUnicorn Service File - - sudo cp /okit/containers/services/gunicorn.service /etc/systemd/system/gunicorn.service + - sudo bash -c "cp -v /okit/containers/services/gunicorn.service /etc/systemd/system/gunicorn.service" # Enable Gunicorn Service - sudo systemctl enable gunicorn.service - sudo systemctl start gunicorn.service diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index 928d8a1be..ca74bbd53 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -40,8 +40,10 @@ RUN yum install -y \ && pip3 install --no-cache-dir \ flask==1.1.1 \ gunicorn==20.0.4 \ - oci==2.6.0 \ + oci==2.22.0 \ + pandas==1.1.2 \ pyyaml==5.2 \ + requests==2.24.0 \ # Create Workspace && mkdir -p /okit/{config,log,visualiser,okitweb,workspace,templates} \ && mkdir -p /okit/okitweb/static/okit/templates \ diff --git a/containers/vagrant/configure_software.sh b/containers/vagrant/configure_software.sh index 7d90404d0..27b148b93 100644 --- a/containers/vagrant/configure_software.sh +++ b/containers/vagrant/configure_software.sh @@ -7,6 +7,7 @@ export PATH=/usr/local/bin:/usr/bin:${PATH} # Install new yum repos yum install -y \ + oraclelinux-developer-release-el7 \ oracle-softwarecollection-release-el7 # Update base image yum update -y @@ -35,14 +36,11 @@ source /etc/bashrc python3 -m pip install --upgrade pip==20.0.2 # Install required python modules -pip3 install \ - click==7.0 \ - flask==1.1.1 \ - gunicorn==20.0.4 \ - itsdangerous==1.1.0 \ - jinja2==2.10.3 \ - markupsafe==1.1.1 \ - oci==2.6.0 \ - pyyaml==5.2 \ - werkzeug==0.16.0 +pip3 install --no-cache-dir \ + flask==1.1.1 \ + gunicorn==20.0.4 \ + oci==2.22.0 \ + pandas==1.1.2 \ + pyyaml==5.2 \ + requests==2.24.0 From bf2104cb2a6f7711bf35a36a2acb0ccea4263f6d Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Fri, 9 Oct 2020 16:16:55 +0100 Subject: [PATCH 07/81] Add xlswriter python library --- containers/cloud/cloud_init.yml | 2 +- containers/docker/Dockerfile | 1 + containers/vagrant/configure_software.sh | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/containers/cloud/cloud_init.yml b/containers/cloud/cloud_init.yml index 39f2a2e42..eef4fdee9 100644 --- a/containers/cloud/cloud_init.yml +++ b/containers/cloud/cloud_init.yml @@ -23,7 +23,7 @@ write_files: runcmd: # Install Required Python Modules - - sudo bash -c "pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci==2.22.0 pandas==1.1.2 pyyaml==5.2 requests==2.24.0" + - sudo bash -c "pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci==2.22.0 pandas==1.1.2 pyyaml==5.2 requests==2.24.0 xlswriter==1.3.6" # Clone OKIT - sudo bash -c "git clone -b toxophilist/sprint-11 --depth 1 https://github.com/oracle/oci-designer-toolkit.git /okit" - sudo bash -c "mkdir /okit/{log,workspace}" diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index ca74bbd53..1173c9547 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -44,6 +44,7 @@ RUN yum install -y \ pandas==1.1.2 \ pyyaml==5.2 \ requests==2.24.0 \ + xlswriter==1.3.6 \ # Create Workspace && mkdir -p /okit/{config,log,visualiser,okitweb,workspace,templates} \ && mkdir -p /okit/okitweb/static/okit/templates \ diff --git a/containers/vagrant/configure_software.sh b/containers/vagrant/configure_software.sh index 27b148b93..043f64a9b 100644 --- a/containers/vagrant/configure_software.sh +++ b/containers/vagrant/configure_software.sh @@ -42,5 +42,6 @@ pip3 install --no-cache-dir \ oci==2.22.0 \ pandas==1.1.2 \ pyyaml==5.2 \ - requests==2.24.0 + requests==2.24.0 \ + xlswriter==1.3.6 From 080e7de8f442138a40348f6f70f375336eced6c7 Mon Sep 17 00:00:00 2001 From: Andrew Hopkinson Date: Fri, 9 Oct 2020 17:40:55 +0100 Subject: [PATCH 08/81] Initial release of MySQL functionality just providing TF --- .gitignore | 1 + okitweb/okitOci.py | 21 ++ okitweb/static/okit/js/okit.js | 16 ++ okitweb/static/okit/json/dropdown.json | 209 ++++++++++++++++-- .../js/artefacts/mysql_database_system.js | 62 ++++++ okitweb/static/okit/model/js/okit_model.js | 35 +++ .../database/MySQL_Database_System.svg | 12 + .../static/okit/query/oci/js/okit_query.js | 30 +++ .../js/artefacts/mysql_database_system.js | 97 ++++++++ .../okit/view/designer/js/artefacts/subnet.js | 2 +- .../view/designer/js/okit_designer_view.js | 4 + okitweb/static/okit/view/js/okit_view.js | 38 ++++ .../propertysheets/mysql_database_system.html | 38 ++++ .../mysql_database_system.html | 5 + visualiser/facades/ociConnection.py | 18 ++ visualiser/facades/ociLoadBalancerShape.py | 58 +++++ visualiser/facades/ociMySQLConfiguration.py | 56 +++++ visualiser/facades/ociMySQLDatabaseSystem.py | 72 ++++++ visualiser/facades/ociMySQLShape.py | 56 +++++ visualiser/facades/ociMySQLVersion.py | 56 +++++ visualiser/generators/okitGenerator.py | 77 +++++++ .../ansible/mysql_database_system.jinja2 | 0 .../terraform/mysql_database_system.jinja2 | 77 +++++++ 23 files changed, 1017 insertions(+), 23 deletions(-) create mode 100644 okitweb/static/okit/model/js/artefacts/mysql_database_system.js create mode 100755 okitweb/static/okit/palette/database/MySQL_Database_System.svg create mode 100644 okitweb/static/okit/view/designer/js/artefacts/mysql_database_system.js create mode 100644 okitweb/templates/okit/propertysheets/mysql_database_system.html create mode 100644 okitweb/templates/okit/valueproposition/mysql_database_system.html create mode 100644 visualiser/facades/ociLoadBalancerShape.py create mode 100644 visualiser/facades/ociMySQLConfiguration.py create mode 100644 visualiser/facades/ociMySQLDatabaseSystem.py create mode 100644 visualiser/facades/ociMySQLShape.py create mode 100644 visualiser/facades/ociMySQLVersion.py create mode 100644 visualiser/templates/ansible/mysql_database_system.jinja2 create mode 100644 visualiser/templates/terraform/mysql_database_system.jinja2 diff --git a/.gitignore b/.gitignore index 7fa64f560..78d591912 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,6 @@ containers/.oci containers/oci/* !containers/oci/example_config +!containers/cloud !okitweb/static/model diff --git a/okitweb/okitOci.py b/okitweb/okitOci.py index 4c06066bd..dd34935c1 100644 --- a/okitweb/okitOci.py +++ b/okitweb/okitOci.py @@ -45,7 +45,12 @@ from facades.ociInternetGateway import OCIInternetGateways from facades.ociIPSecConnection import OCIIPSecConnections from facades.ociLoadBalancer import OCILoadBalancers +from facades.ociLoadBalancerShape import OCILoadBalancerShapes from facades.ociLocalPeeringGateway import OCILocalPeeringGateways +from facades.ociMySQLConfiguration import OCIMySQLConfigurations +from facades.ociMySQLDatabaseSystem import OCIMySQLDatabaseSystems +from facades.ociMySQLShape import OCIMySQLShapes +from facades.ociMySQLVersion import OCIMySQLVersions from facades.ociNATGateway import OCINATGateways from facades.ociNetworkSecurityGroup import OCINetworkSecurityGroups from facades.ociObjectStorageBuckets import OCIObjectStorageBuckets @@ -261,6 +266,10 @@ def ociArtifacts(artifact): logger.info('---- Processing LocalPeeringGateways') oci_local_peering_gateways = OCILocalPeeringGateways(config=config, profile=config_profile, compartment_id=query_json['compartment_id'], vcn_id=query_json['vcn_id']) response_json = oci_local_peering_gateways.list(filter=query_json.get('local_peering_gateway_filter', None)) + elif artifact == 'MySQLDatabaseSystem': + logger.info('---- Processing MySQL Database Systems') + oci_mysql_database_systems = OCIMySQLDatabaseSystems(config=config, profile=config_profile, compartment_id=query_json['compartment_id']) + response_json = oci_mysql_database_systems.list(filter=query_json.get('mysql_database_system_filter', None)) elif artifact == 'NATGateway': logger.info('---- Processing NAT Gateways') oci_nat_gateways = OCINATGateways(config=config, profile=config_profile, compartment_id=query_json['compartment_id'], vcn_id=query_json['vcn_id']) @@ -338,6 +347,18 @@ def dropdownQuery(): # Fast Connect Provider Services fast_connect_provider_services = OCIFastConnectProviderServices() dropdown_json["fast_connect_provider_services"] = sorted(fast_connect_provider_services.list(), key=lambda k: k['provider_name']) + # MySQL Shapes + mysql_shapes = OCIMySQLShapes() + dropdown_json["mysql_shapes"] = sorted(mysql_shapes.list(), key=lambda k: k['name']) + # Database Versions + mysql_versions = OCIMySQLVersions() + dropdown_json["mysql_versions"] = sorted(mysql_versions.list(), key=lambda k: k['version_family']) + # MySQL Configurations + mysql_configurations = OCIMySQLConfigurations() + dropdown_json["mysql_configurations"] = sorted(mysql_configurations.list(), key=lambda k: k['display_name']) + # Instance Shapes + oci_loadbalancer_shapes = OCILoadBalancerShapes() + dropdown_json["loadbalancer_shapes"] = oci_loadbalancer_shapes.list() return dropdown_json else: return 'Unknown Method', 500 diff --git a/okitweb/static/okit/js/okit.js b/okitweb/static/okit/js/okit.js index 5771ed472..5a52d3c05 100644 --- a/okitweb/static/okit/js/okit.js +++ b/okitweb/static/okit/js/okit.js @@ -171,6 +171,22 @@ class OkitOCIData { return [...new Set(images)].sort((a, b) => b - a); } + getMySQLConfigurations(shape_name='') { + if (shape_name === '') { + return this.mysql_configurations; + } else { + return this.mysql_configurations.filter(function(dss) {return dss.shape_name === shape_name;}); + } + } + + getMySQLShapes() { + return this.mysql_shapes; + } + + getMySQLVersions(family='') { + return this.mysql_versions[0].versions; + } + getRegions() { return this.regions; } diff --git a/okitweb/static/okit/json/dropdown.json b/okitweb/static/okit/json/dropdown.json index d51d65c65..990393438 100644 --- a/okitweb/static/okit/json/dropdown.json +++ b/okitweb/static/okit/json/dropdown.json @@ -110,6 +110,7 @@ "db_system_shapes": [ { "available_core_count": 36, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 9, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -127,6 +128,7 @@ }, { "available_core_count": 52, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 16, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -144,6 +146,7 @@ }, { "available_core_count": 48, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -161,6 +164,7 @@ }, { "available_core_count": 336, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -178,6 +182,7 @@ }, { "available_core_count": 368, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -195,6 +200,7 @@ }, { "available_core_count": 400, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -212,6 +218,7 @@ }, { "available_core_count": 168, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -229,6 +236,7 @@ }, { "available_core_count": 184, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -246,6 +254,7 @@ }, { "available_core_count": 200, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -263,6 +272,7 @@ }, { "available_core_count": 84, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -280,6 +290,7 @@ }, { "available_core_count": 92, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -297,6 +308,7 @@ }, { "available_core_count": 100, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -314,6 +326,7 @@ }, { "available_core_count": null, + "available_core_count_per_node": 50, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": null, @@ -331,6 +344,7 @@ }, { "available_core_count": 44, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 42, "available_db_node_storage_in_g_bs": 2200, "available_memory_in_gbs": 480, @@ -348,6 +362,7 @@ }, { "available_core_count": 48, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 74, "available_db_node_storage_in_g_bs": 1800, "available_memory_in_gbs": 720, @@ -365,6 +380,7 @@ }, { "available_core_count": 48, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 74, "available_db_node_storage_in_g_bs": 1800, "available_memory_in_gbs": 656, @@ -382,6 +398,7 @@ }, { "available_core_count": 368, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 427, "available_db_node_storage_in_g_bs": 8800, "available_memory_in_gbs": 5760, @@ -399,6 +416,7 @@ }, { "available_core_count": 400, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 598, "available_db_node_storage_in_g_bs": 7200, "available_memory_in_gbs": 5760, @@ -416,6 +434,7 @@ }, { "available_core_count": 400, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 598, "available_db_node_storage_in_g_bs": 7200, "available_memory_in_gbs": 11120, @@ -433,6 +452,7 @@ }, { "available_core_count": 184, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 213, "available_db_node_storage_in_g_bs": 4400, "available_memory_in_gbs": 2880, @@ -450,6 +470,7 @@ }, { "available_core_count": 200, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 299, "available_db_node_storage_in_g_bs": 3600, "available_memory_in_gbs": 2880, @@ -467,6 +488,7 @@ }, { "available_core_count": 200, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 299, "available_db_node_storage_in_g_bs": 3600, "available_memory_in_gbs": 5560, @@ -484,6 +506,7 @@ }, { "available_core_count": 92, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 106, "available_db_node_storage_in_g_bs": 2200, "available_memory_in_gbs": 1440, @@ -501,6 +524,7 @@ }, { "available_core_count": 100, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 149, "available_db_node_storage_in_g_bs": 1800, "available_memory_in_gbs": 1440, @@ -518,6 +542,7 @@ }, { "available_core_count": 100, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": 149, "available_db_node_storage_in_g_bs": 1800, "available_memory_in_gbs": 2780, @@ -535,6 +560,7 @@ }, { "available_core_count": 1, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 7, @@ -552,6 +578,7 @@ }, { "available_core_count": 16, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 112, @@ -569,6 +596,7 @@ }, { "available_core_count": 2, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 14, @@ -586,6 +614,7 @@ }, { "available_core_count": 4, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 28, @@ -603,6 +632,7 @@ }, { "available_core_count": 8, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 56, @@ -620,6 +650,7 @@ }, { "available_core_count": 1, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 15, @@ -637,6 +668,7 @@ }, { "available_core_count": 16, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 240, @@ -654,6 +686,7 @@ }, { "available_core_count": 2, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 30, @@ -671,6 +704,7 @@ }, { "available_core_count": 24, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 320, @@ -688,6 +722,7 @@ }, { "available_core_count": 4, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 60, @@ -705,6 +740,7 @@ }, { "available_core_count": 8, + "available_core_count_per_node": null, "available_data_storage_in_t_bs": null, "available_db_node_storage_in_g_bs": null, "available_memory_in_gbs": 120, @@ -807,12 +843,12 @@ { "bandwith_shape_management": "CUSTOMER_MANAGED", "customer_asn_management": "CUSTOMER_MANAGED", - "description": "https://www.centurylink.com/business/hybrid-it-cloud/cloud-connect.html", - "id": "ocid1.providerservice.oc1.phx.aaaaaaaa5dbfeyv4ndgbbd7j26a7yjzttgyxrh37jvrmmei6w7rikubd7lkq", + "description": "http://www.coresite.com\t", + "id": "ocid1.providerservice.oc1.phx.aaaaaaaahriodfhfpjpunyzpt75dbdjw7vzwae5qo7w6wgkgdn7abweq5zdq", "private_peering_bgp_management": "CUSTOMER_MANAGED", - "provider_name": "CenturyLink", + "provider_name": "CoreSite", "provider_service_key_management": "PROVIDER_MANAGED", - "provider_service_name": "Cloud Connect", + "provider_service_name": "Open Cloud Exchange", "public_peering_bgp_management": "ORACLE_MANAGED", "required_total_cross_connects": 1, "supported_virtual_circuit_types": [ @@ -862,12 +898,12 @@ { "bandwith_shape_management": "CUSTOMER_MANAGED", "customer_asn_management": "CUSTOMER_MANAGED", - "description": "http://www.coresite.com\t", - "id": "ocid1.providerservice.oc1.phx.aaaaaaaahriodfhfpjpunyzpt75dbdjw7vzwae5qo7w6wgkgdn7abweq5zdq", + "description": "https://marketplaceportal.com/web/guest/login", + "id": "ocid1.providerservice.oc1.phx.aaaaaaaashhewqxvazysllofspiuang2osntf5x4qjua2u2v4brcsjpmnlya", "private_peering_bgp_management": "CUSTOMER_MANAGED", - "provider_name": "CoreSite", + "provider_name": "Digital Realty", "provider_service_key_management": "PROVIDER_MANAGED", - "provider_service_name": "Open Cloud Exchange", + "provider_service_name": "Service Exchange", "public_peering_bgp_management": "ORACLE_MANAGED", "required_total_cross_connects": 1, "supported_virtual_circuit_types": [ @@ -879,18 +915,22 @@ { "bandwidth_in_mbps": 1000, "name": "1 Gbps" + }, + { + "bandwidth_in_mbps": 10000, + "name": "10 Gbps" } ] }, { "bandwith_shape_management": "CUSTOMER_MANAGED", "customer_asn_management": "CUSTOMER_MANAGED", - "description": "https://marketplaceportal.com/web/guest/login", - "id": "ocid1.providerservice.oc1.phx.aaaaaaaashhewqxvazysllofspiuang2osntf5x4qjua2u2v4brcsjpmnlya", + "description": "https://www.edgeconnex.com/", + "id": "ocid1.providerservice.oc1.phx.aaaaaaaakaplcuq6oxfdcbeb2g2syfudupywyfelaajfbvoupz2ulljho3jq", "private_peering_bgp_management": "CUSTOMER_MANAGED", - "provider_name": "Digital Realty", + "provider_name": "EdgeConneX", "provider_service_key_management": "PROVIDER_MANAGED", - "provider_service_name": "Service Exchange", + "provider_service_name": "Cloud Services", "public_peering_bgp_management": "ORACLE_MANAGED", "required_total_cross_connects": 1, "supported_virtual_circuit_types": [ @@ -912,12 +952,12 @@ { "bandwith_shape_management": "CUSTOMER_MANAGED", "customer_asn_management": "CUSTOMER_MANAGED", - "description": "https://www.edgeconnex.com/", - "id": "ocid1.providerservice.oc1.phx.aaaaaaaakaplcuq6oxfdcbeb2g2syfudupywyfelaajfbvoupz2ulljho3jq", + "description": "http://www.equinix.com/services/interconnection-connectivity/cloud-exchange/", + "id": "ocid1.providerservice.oc1.phx.aaaaaaaavaux3ugttlfiwv3mctfikgt4ofm4r7eyvly3a2usvrec34aamv7q", "private_peering_bgp_management": "CUSTOMER_MANAGED", - "provider_name": "EdgeConneX", + "provider_name": "Equinix", "provider_service_key_management": "PROVIDER_MANAGED", - "provider_service_name": "Cloud Services", + "provider_service_name": "CloudExchange", "public_peering_bgp_management": "ORACLE_MANAGED", "required_total_cross_connects": 1, "supported_virtual_circuit_types": [ @@ -930,6 +970,22 @@ "bandwidth_in_mbps": 1000, "name": "1 Gbps" }, + { + "bandwidth_in_mbps": 2000, + "name": "2 Gbps" + }, + { + "bandwidth_in_mbps": 3000, + "name": "3 Gbps" + }, + { + "bandwidth_in_mbps": 4000, + "name": "4 Gbps" + }, + { + "bandwidth_in_mbps": 5000, + "name": "5 Gbps" + }, { "bandwidth_in_mbps": 10000, "name": "10 Gbps" @@ -939,12 +995,12 @@ { "bandwith_shape_management": "CUSTOMER_MANAGED", "customer_asn_management": "CUSTOMER_MANAGED", - "description": "http://www.equinix.com/services/interconnection-connectivity/cloud-exchange/", - "id": "ocid1.providerservice.oc1.phx.aaaaaaaavaux3ugttlfiwv3mctfikgt4ofm4r7eyvly3a2usvrec34aamv7q", + "description": "https://www.centurylink.com/business/hybrid-it-cloud/cloud-connect.html", + "id": "ocid1.providerservice.oc1.phx.aaaaaaaa5dbfeyv4ndgbbd7j26a7yjzttgyxrh37jvrmmei6w7rikubd7lkq", "private_peering_bgp_management": "CUSTOMER_MANAGED", - "provider_name": "Equinix", + "provider_name": "Lumen", "provider_service_key_management": "PROVIDER_MANAGED", - "provider_service_name": "CloudExchange", + "provider_service_name": "Cloud Connect", "public_peering_bgp_management": "ORACLE_MANAGED", "required_total_cross_connects": 1, "supported_virtual_circuit_types": [ @@ -958,8 +1014,8 @@ "name": "1 Gbps" }, { - "bandwidth_in_mbps": 2000, - "name": "2 Gbps" + "bandwidth_in_mbps": 10000, + "name": "10 Gbps" }, { "bandwidth_in_mbps": 3000, @@ -3646,6 +3702,110 @@ "time_created": "2020-05-26T21:50:51.365000+00:00" } ], + "loadbalancer_shapes": [ + { + "name": "100Mbps" + }, + { + "name": "10Mbps" + }, + { + "name": "10Mbps-Micro" + }, + { + "name": "400Mbps" + }, + { + "name": "8000Mbps" + } + ], + "mysql_configurations": [ + { + "compartment_id": null, + "defined_tags": null, + "description": "Default configuration for the VM.Standard.E2.1 MySQL Shape", + "display_name": "VM.Standard.E2.1.Built-in", + "freeform_tags": null, + "id": "ocid1.mysqlconfiguration.oc1..aaaaaaaah6o6qu3gdbxnqg6aw56amnosmnaycusttaa7abyq2tdgpgubvsgi", + "lifecycle_state": "ACTIVE", + "shape_name": "VM.Standard.E2.1", + "time_created": "2018-09-21T10:00:00+00:00", + "time_updated": null, + "type": "DEFAULT" + }, + { + "compartment_id": null, + "defined_tags": null, + "description": "Default configuration for the VM.Standard.E2.2 MySQL Shape", + "display_name": "VM.Standard.E2.2.Built-in", + "freeform_tags": null, + "id": "ocid1.mysqlconfiguration.oc1..aaaaaaaah6o6qu3gdbxnqg6aw56amnosmnaycusttaa7abyq2tdgpgubvsgj", + "lifecycle_state": "ACTIVE", + "shape_name": "VM.Standard.E2.2", + "time_created": "2018-09-21T10:00:00+00:00", + "time_updated": null, + "type": "DEFAULT" + }, + { + "compartment_id": null, + "defined_tags": null, + "description": "Default configuration for the VM.Standard.E2.4 MySQL Shape", + "display_name": "VM.Standard.E2.4.Built-in", + "freeform_tags": null, + "id": "ocid1.mysqlconfiguration.oc1..aaaaaaaah6o6qu3gdbxnqg6aw56amnosmnaycusttaa7abyq2tdgpgubvsgk", + "lifecycle_state": "ACTIVE", + "shape_name": "VM.Standard.E2.4", + "time_created": "2018-09-21T10:00:00+00:00", + "time_updated": null, + "type": "DEFAULT" + }, + { + "compartment_id": null, + "defined_tags": null, + "description": "Default configuration for the VM.Standard.E2.8 MySQL Shape", + "display_name": "VM.Standard.E2.8.Built-in", + "freeform_tags": null, + "id": "ocid1.mysqlconfiguration.oc1..aaaaaaaah6o6qu3gdbxnqg6aw56amnosmnaycusttaa7abyq2tdgpgubvsgl", + "lifecycle_state": "ACTIVE", + "shape_name": "VM.Standard.E2.8", + "time_created": "2018-09-21T10:00:00+00:00", + "time_updated": null, + "type": "DEFAULT" + } + ], + "mysql_shapes": [ + { + "cpu_core_count": 1, + "memory_size_in_gbs": 8, + "name": "VM.Standard.E2.1" + }, + { + "cpu_core_count": 2, + "memory_size_in_gbs": 16, + "name": "VM.Standard.E2.2" + }, + { + "cpu_core_count": 4, + "memory_size_in_gbs": 32, + "name": "VM.Standard.E2.4" + }, + { + "cpu_core_count": 8, + "memory_size_in_gbs": 64, + "name": "VM.Standard.E2.8" + } + ], + "mysql_versions": [ + { + "version_family": "8.0", + "versions": [ + { + "description": "8.0.21", + "version": "8.0.21" + } + ] + } + ], "regions": [ { "display_name": "AP Chuncheon", @@ -4024,6 +4184,11 @@ "display_name": "vcn", "name": "vcn" }, + { + "description": "IP Management", + "display_name": "vcnip", + "name": "vcnip" + }, { "description": "VPN", "display_name": "vpn", diff --git a/okitweb/static/okit/model/js/artefacts/mysql_database_system.js b/okitweb/static/okit/model/js/artefacts/mysql_database_system.js new file mode 100644 index 000000000..2da5095a7 --- /dev/null +++ b/okitweb/static/okit/model/js/artefacts/mysql_database_system.js @@ -0,0 +1,62 @@ +/* +** Copyright (c) 2020, Oracle and/or its affiliates. +** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. +*/ +console.info('Loaded Database System Javascript'); + +/* +** Define Autonomous Database Class + */ +class MySQLDatabaseSystem extends OkitArtifact { + /* + ** Create + */ + constructor (data={}, okitjson={}) { + super(okitjson); + // Configure default values + this.display_name = this.generateDefaultName(okitjson.mysql_database_systems.length + 1); + this.compartment_id = data.parent_id; + this.availability_domain = 1; + this.hostname_label = this.display_name.toLowerCase(); + this.shape_name = ''; + this.configuration_id = ''; + this.subnet_id = ''; + this.admin_username = ''; + this.admin_password = ''; + this.description =''; + this.mysql_version = ''; + this.port = ''; + this.port_x = ''; + this.data_storage_size_in_gb = 256; + this.fault_domain = ''; + // Update with any passed data + this.merge(data); + this.convert(); + // Check if built from a query + if (this.availability_domain.length > 1) { + this.region_availability_domain = this.availability_domain; + this.availability_domain = this.getAvailabilityDomainNumber(this.region_availability_domain); + } + } + + + /* + ** Clone Functionality + */ + clone() { + return new MySQLDatabaseSystem(this, this.getOkitJson()); + } + + + getNamePrefix() { + return super.getNamePrefix() + 'mysql'; + } + + /* + ** Static Functionality + */ + static getArtifactReference() { + return 'MySQL Database System'; + } + +} diff --git a/okitweb/static/okit/model/js/okit_model.js b/okitweb/static/okit/model/js/okit_model.js index dd6a9d1e7..b7e48db4b 100644 --- a/okitweb/static/okit/model/js/okit_model.js +++ b/okitweb/static/okit/model/js/okit_model.js @@ -29,6 +29,7 @@ class OkitJson { this.ipsec_connections = []; this.load_balancers = []; this.local_peering_gateways = []; + this.mysql_database_systems = []; this.nat_gateways = []; this.network_security_groups = []; this.object_storage_buckets = []; @@ -214,6 +215,13 @@ class OkitJson { console.info(obj); } } + // MySQL Database Systems + if (okit_json.hasOwnProperty('mysql_database_systems')) { + for (let artefact of okit_json['mysql_database_systems']) { + let obj = this.newMySQLDatabaseSystem(artefact); + console.info(obj); + } + } // Instances if (okit_json.hasOwnProperty('instances')) { for (let artefact of okit_json['instances']) { @@ -615,6 +623,33 @@ class OkitJson { } } + // MySQL Database System + newMySQLDatabaseSystem(data) { + console.info('New MySQL Database System'); + this.mysql_database_systems.push(new MySQLDatabaseSystem(data, this)); + return this.mysql_database_systems[this.mysql_database_systems.length - 1]; + } + getMySQLDatabaseSystems() { + return this.mysql_database_systems; + } + getMySQLDatabaseSystem(id='') { + for (let artefact of this.getMySQLDatabaseSystems()) { + if (artefact.id === id) { + return artefact; + } + } + return undefined; + } + deleteMySQLDatabaseSystem(id) { + for (let i = 0; i < this.mysql_database_systems.length; i++) { + if (this.mysql_database_systems[i].id === id) { + this.database_systems[i].delete(); + this.database_systems.splice(i, 1); + break; + } + } + } + // NAT Gateway newNATGateway(data) { console.info('New NAT Gateway'); diff --git a/okitweb/static/okit/palette/database/MySQL_Database_System.svg b/okitweb/static/okit/palette/database/MySQL_Database_System.svg new file mode 100755 index 000000000..df516529b --- /dev/null +++ b/okitweb/static/okit/palette/database/MySQL_Database_System.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/okitweb/static/okit/query/oci/js/okit_query.js b/okitweb/static/okit/query/oci/js/okit_query.js index 1b0845ecb..179861a6f 100644 --- a/okitweb/static/okit/query/oci/js/okit_query.js +++ b/okitweb/static/okit/query/oci/js/okit_query.js @@ -188,6 +188,7 @@ class OkitOCIQuery { this.queryIPSecConnections(request); this.queryRemotePeeringConnections(request); this.queryDatabaseSystems(request); + this.queryMySQLDatabaseSystems(request); this.queryFileStorageSystems(request); this.queryOkeClusters(request); } @@ -516,6 +517,35 @@ class OkitOCIQuery { }); } + queryMySQLDatabaseSystems(request) { + console.info('------------- Autonomous Database Query --------------------'); + console.info('------------- Compartment : ' + request.compartment_id); + let me = this; + this.region_query_count[request.region]++; + $.ajax({ + type: 'get', + url: 'oci/artefacts/MySQLDatabaseSystem', + dataType: 'text', + contentType: 'application/json', + data: JSON.stringify(request), + success: function(resp) { + let response_json = JSON.parse(resp); + regionOkitJson[request.region].load({mysql_database_systems: response_json}); + for (let artefact of response_json) { + console.info(artefact.display_name); + } + if (request.refresh) {okitJsonView.draw();} + }, + error: function(xhr, status, error) { + console.info('Status : ' + status) + console.info('Error : ' + error) + }, + complete: function () { + me.region_query_count[request.region]-- && me.isComplete(); + } + }); + } + queryNATGateways(request) { console.info('------------- NAT Gateway Query --------------------'); console.info('------------- Compartment : ' + request.compartment_id); diff --git a/okitweb/static/okit/view/designer/js/artefacts/mysql_database_system.js b/okitweb/static/okit/view/designer/js/artefacts/mysql_database_system.js new file mode 100644 index 000000000..b9fc1d662 --- /dev/null +++ b/okitweb/static/okit/view/designer/js/artefacts/mysql_database_system.js @@ -0,0 +1,97 @@ +/* +** Copyright (c) 2020, Oracle and/or its affiliates. +** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. +*/ +console.info('Loaded Designer MySQLDatabaseSystem View Javascript'); + +/* +** Define MySQLDatabaseSystem View Artifact Class + */ +class MySQLDatabaseSystemView extends OkitDesignerArtefactView { + constructor(artefact=null, json_view) { + super(artefact, json_view); + } + + get parent_id() {return this.artefact.subnet_id;} + get parent() {return this.getJsonView().getSubnet(this.parent_id);} + get minimum_width() {return 135;} + get minimum_height() {return 100;} + + /* + ** SVG Processing + */ + // Return Artifact Specific Definition. + getSvgDefinition() { + let definition = this.newSVGDefinition(this, this.getArtifactReference()); + if (this.getParent()) { + let first_child = this.getParent().getChildOffset(this.getArtifactReference()); + definition['svg']['x'] = first_child.dx; + definition['svg']['y'] = first_child.dy; + } + definition['svg']['width'] = this.dimensions['width']; + definition['svg']['height'] = this.dimensions['height']; + definition['svg']['align'] = "center"; + definition['rect']['stroke']['colour'] = stroke_colours.bark; + definition['rect']['stroke']['dash'] = 1; + definition['rect']['height_adjust'] = (Math.round(icon_height / 2) * -1); + definition['name']['show'] = true; + definition['name']['align'] = "center"; + return definition; + } + + /* + ** Property Sheet Load function + */ + loadProperties() { + let okitJson = this.getOkitJson(); + let me = this; + $(jqId(PROPERTIES_PANEL)).load("propertysheets/mysql_database_system.html", () => { + // Load DB System Configurations + let configuration_select = $(jqId('configuration_id')); + // Load DB System Shapes + let shape_select = $(jqId('shape_name')); + $(shape_select).empty(); + for (let shape of okitOciData.getMySQLShapes()) { + shape_select.append($('