Skip to content

Commit

Permalink
Merge pull request #160 from oracle/sprint-11
Browse files Browse the repository at this point in the history
Sprint 11/v.0.13.0 Release
  • Loading branch information
toxophilist authored Oct 28, 2020
2 parents 1d2c838 + f09fbf7 commit 66a6f29
Show file tree
Hide file tree
Showing 83 changed files with 4,415 additions and 653 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ containers/.oci

containers/oci/*
!containers/oci/example_config
!containers/cloud

!okitweb/static/model
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Release Notes


## Version 0.13.0
**Release Date**: 28th October 2020
### Features
1. Read Load Balancer Shapes from OCI / Cached OCI Values
2. Simple Command Line generator (visualiser/okit_generator) to convert OKIT.
3. Add MySQL Resource / Artefact.
4. Add Cost Estimation functionality for the designed model. This is based on the Oracle public APIs.
5. Add top-level Dockerfile and update Runtime build documentation.
6. Enable Instance Principal Authentication for Query/Resource Manager.

### Bug Fixes
1. Build script on Windows fail (Issue: #135)
2. Instances were picking up Network Security Groups assigned to Autonomous Database during Terraform generation.
3. Decoding Instance Metadata cloud-init data fails to decode .(Issue: #55)

## Version 0.12.0
**Release Date**: 7th October 2020
### Features
Expand Down
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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.

FROM oraclelinux:7-slim
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/oci-designer-toolkit/issues" \
"version"="0.13.0" \
"description"="OKIT Web Server Container." \
"copyright"="Copyright (c) 2020, Oracle and/or its affiliates."
SHELL ["/bin/bash", "-c"]
ENV PYTHONIOENCODING=utf8 \
PYTHONPATH=":/okit/visualiser:/okit/okitweb:/okit" \
FLASK_APP=okitweb \
FLASK_DEBUG=1 \
LANG=en_GB.UTF-8 \
LANGUAGE=en_GB:en \
LC_ALL=en_GB.UTF-8 \
PATH=/root/bin:${PATH}
# Expose Ports
EXPOSE 80
EXPOSE 443
# Copy source code
COPY containers/oci/* /root/.oci/
COPY containers/docker/run-server.sh /root/bin/
# Install new yum repos
RUN yum install -y \
oracle-softwarecollection-release-el7 \
oraclelinux-developer-release-el7 \
# Disable oci config repo
&& yum-config-manager --disable ol7_ociyum_config \
# Update base image
&& yum update -y \
# Install additional packages
&& yum install -y \
git \
python36 \
python3-pip \
&& rm -rf /var/cache/yum \
# Upgrade pip
&& python3 -m pip install --upgrade pip==20.0.2 \
# Install required python modules
&& pip3 install --no-cache-dir \
flask==1.1.1 \
gunicorn==20.0.4 \
oci==2.22.0 \
pandas==1.1.2 \
python-magic==0.4.18 \
pyyaml==5.2 \
requests==2.24.0 \
xlsxwriter==1.3.6 \
# Create Workspace
&& mkdir -p /github \
&& git clone https://github.com/oracle/oci-designer-toolkit.git /github/oci-designer-toolkit \
&& mkdir -p /okit/{log,workspace} \
&& ln -sv /github/oci-designer-toolkit/okitweb /okit/okitweb \
&& ln -sv /github/oci-designer-toolkit/visualiser /okit/visualiser \
&& mkdir -p /okit/okitweb/static/okit/templates \
&& ln -sv /okit/templates /okit/okitweb/static/okit/templates/user \
&& chmod a+x /root/bin/run-server.sh
# Add entrypoint to automatically start webserver
CMD ["run-server.sh"]
65 changes: 45 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OCI Designer Toolkit [0.12.0](CHANGELOG.md#version-0.12.0)
# Oracle Cloud Infrastructure Designer and Visualisation 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),
OCI designer and visualisation 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))
OCI environments through a graphical web based interface.

Expand Down Expand Up @@ -34,19 +34,52 @@ OCI environments through a graphical web based interface.
## Installation
Detailed OKIT Installation steps can be found in the [OCI Designer Toolkit Installation Guide](documentation/Installation.md).

### Quick Start
The docker image is the recommended runtime server OKIT provides a simple Docker Compose script to build and start the container.
_Note:_
```diff
- OKIT is designed to be installed as a local single user container and it is recommended that you
- do NOT install OKIT on an OCI Instance. Installing on an OCI Instance will leave you OCI Tenancy
- open to anyone who can find the IP address. If you do decide to install on an OCI Instance the
- OCI Designer Toolkit Installation Guide will give some recommendations for securing your Instance.
```

### Runtime Quick Start
[Docker](https://www.docker.com/products/docker-desktop) is the recommended runtime container for OKIT. The project contains a top-level Dockerfile to facilitate direct
building, of the runtime environment, from the docker command line.

#### Prerequisites
Before building / running OKIT you will need to install [Docker / Docker Desktop](https://www.docker.com/products/docker-desktop).

#### Build Docker Container
```bash
docker build --tag okit --force-rm https://github.com/oracle/oci-designer-toolkit.git
```

#### Create / Generate Connection Information
If you already have the OCI sdk/cli installed on you machine you can use the previously generated pem key and config file
we will assume that this exists in <USER HOME DIR>/.oci

##### Key File

#### Clone Repository
If you do not have a previously generated private key you will need to create a private/public key pair for use with OKIT and OCI.
These keys can be generated using the following commands as defined in [Required Keys and OCIDs](https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm).

```bash
openssl genrsa -out <USER HOME DIR>/.oci/oci_api_key.pem 2048
openssl rsa -pubout -in <USER HOME DIR>/.oci/oci_api_key.pem -out <USER HOME DIR>/.oci/oci_api_key_public.pem
```

Upload the generated __oci_api_key_public.pem__ to OCI through the [console](https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm) and record the associated fingerprint following upload.

###### Get Fingerprint
```bash
git clone --depth 1 https://github.com/oracle/oci-designer-toolkit.git
openssl rsa -pubout -outform DER -in ~/.oci/oci_api_key.pem | openssl md5 -c
```

#### Create Config File
##### Config File

Create the OCI cli __config__ file in the directory __oci-designer-toolkit/containers/oci__ with contents similar to that below.
The __*key_file*__ is a fixed value because the contents of the __oci-designer-toolkit/containers/oci__ will be copied to the
appropriate users home directory, as __~/.oci__, during the build process.
Create the OCI cli __config__ file in the directory __&lt;USER HOME DIR&gt;/.oci__ with contents similar to that below.
The __*key_file*__ is a fixed value because the contents of the __&lt;USER HOME DIR&gt;/.oci__ will be mounted to the
appropriate users home directory, as __~/.oci__, during the run process.

```properties
[DEFAULT]
Expand All @@ -57,20 +90,12 @@ tenancy=ocid1.tenancy.oc1..aaaaaaaawpqblfem........
region=us-phoenix-1
```

#### Copy Key File

Copy your __oci_api_key.pem__ to the __oci-designer-toolkit/containers/oci__ directory.

#### Build and Start
#### Run Container

```bash
cd oci-designer-toolkit/containers/docker
docker-compose up --detach
docker run -d --rm -p 80:80 --volume <USER HOME DIR>/okit/user/templates:/okit/templates --volume <USER HOME DIR>/.oci:/root/.oci --name okit okit
```

__*Note:*__ For full connection to OCI you will need to follow the [Installation Create Config File instruction](documentation/Installation.md#oci-config-file)
prior to building.

Once started the Designer BUI can be accessed on [http://localhost/okit/designer](http://localhost/okit/designer)


Expand Down
29 changes: 29 additions & 0 deletions containers/cloud/cloud_init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#cloud-config
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'
runcmd:
# Install Required Packages because the packages section may not complete before the runcmd
- sudo bash -c "yum install -y git python-oci-cli oci-utils"
# Install Required Python Modules
- sudo bash -c "pip3 install --no-cache-dir flask==1.1.1 gunicorn==20.0.4 oci==2.22.0 oci-cli==2.14.1 pandas==1.1.2 python-magic==0.4.18 pyyaml==5.2 requests==2.24.0 xlsxwriter==1.3.6"
# Clone OKIT
- sudo bash -c "git clone -b master --depth 1 https://github.com/oracle/oci-designer-toolkit.git /okit"
- sudo bash -c "mkdir /okit/{log,workspace}"
# Add additional environment information because append does not appear to work in write_file
- sudo bash -c "echo 'source /etc/.bashrc' >> /etc/bashrc"
- sudo bash -c "echo 'export OCI_CLI_AUTH=instance_principal' >> /etc/bashrc"
- sudo bash -c "echo 'export OKIT_VM_COMPARTMENT=`oci-metadata -g "compartmentID" --value-only`' >> /etc/bashrc"
# Copy GUnicorn Service File
- sudo bash -c 'sed "s/{COMPARTMENT_OCID}/`oci-metadata -g compartmentID --value-only`/" /okit/containers/services/gunicorn.service > /etc/systemd/system/gunicorn.service'
# Enable Gunicorn Service
- sudo systemctl enable gunicorn.service
- sudo systemctl start gunicorn.service

final_message: "**** The system is finally up, after $UPTIME seconds ****"
Loading

0 comments on commit 66a6f29

Please sign in to comment.