Posts

Showing posts from 2020

Getting started with Serverless on Oracle Cloud

Image
  Serverless computing is where your cloud provider runs the servers in which your eventual application code runs, dynamically allocating resources. It allow you as the developer can focus on your application code. Functions can be manually triggered, or fire in response to events in the tenancy, such as a compute instance changing state. Installation The platform the supports serverless on Oracle Cloud is The Fn Project . So to get started the first task we need to do is install this in our local machine. The pre-requisites for this software is Docker - as at time of writing, this requires a minimum docker version of 17.10. If you're on Ubuntu you can install from the package docker.io . Alternatively, you can review the installation docs for best steps to install on your platform. Once Docker is installed, to install Fn, you can follow the install instructions as mentioned within their GitHub documentation . For a Linux environment, this is basically a matter of running an insta

Remote coding with Go and the OCI SDK

Image
Overview For our OCI work, we have some developed some tooling using the command line client, and usually development is done on my local machine and then later deployed onto a server housed within OCI, where we leverage instance principal authentication.  There is one problem with this architecture of development. You're not doing a like for like development with creating the tools and where they actually end up running, because locally you have to use a token authentication, whereas the underlying tools end up living on a server that relies on dynamic groups for instance principal authentication.  A better practice would be if you development was done with the same dynamic group applying to where you develop your code. Thankfully, a popular text editor/IDE, VSCode, has some tooling around remote development - so that on our local machine we can set up a SSH host to a server on OCI. OCI Setup Server The first step is to set up the environment where we will do our development that

New PL/SQL Array Enhancements in Oracle Database 20c

Image
I was catching up on some PL/SQL office hours the other day, and one of the topics was A Preview of Oracle Database 20c PL/SQL Enhancements . The parts of this session that I was particularly interested in were: Extended Iterator Constructs Aggregate Qualified Expressions Before we get started, it's worth noting these features are on version 20c of the Oracle Database, which has not yet been released. You can however boot up a preview version of this software from within Oracle Cloud. Environment Set Up To get set up, head over to your Oracle Cloud tenancy, assuming you have one. If you don't have one, you can sign up for a free trial and use this in your trial period. I am assuming you already have a Virtual Cloud Network configured, so I won't be diving into that aspect. Once you are signed into your cloud environment, on the menu navigate to Bare Metal, VM, and Exadata from within the Oracle Database section. From this landing page, click the button Create DB System .

A Universal Theme Adventure: Header Height

Image
This will be the first post in a series of posts covering some aspects of working with universal theme, where I hope to explore some more of Universal Theme and broaden my knowledge in the process. What first? I want to change the height of the header bar. To get started I create a brand new application - accepting any and all defaults. Any changes to a design/theme usually begins with Theme Roller, so first off: Theme Roller The first, and most obvious way is to leverage Theme Roller. Running the application, in the developer toolbar and select Theme Roller off to the right.  Within Theme Roller, there is one section titled Layout. This gives us a number of options, one of which is Header Height:   This gives us a slide with some preset options between 40 and 80 pixels, with increments of 4 pixels. (It's worth a brief mention that this range is defined from the Input Parameter File URLs given by the path: #THEME_IMAGES#less/theme/Vita.less, in the theme settings). As you adjust

Customising APEX built-in validation messages

Image
I was working on an application and when trying to save some data, I was getting these error messages despite the fact I had no validations on my page. And what I wanted to know, how do I change these message contents? APEX does some default checking based on entered data. A prime example of this is a date field. On a brand new application, I created a region and added a page item with the type as "Date Picker". If I enter text into the date input field that is not a date conforming to the date format, I will get the following error: "Date Field does not match format DS."   First of all, DS? What is that? This particular application was created by uploading a spreadsheet, and I did not set that. In fact, my spreadsheet had no date data to begin with. In saying that, a quick search in the globalization attributes, and somehow this application has the date format set to "DS". So first, let us change that - I like to use DD-MON-YYYY. So that fixes the error

Iterating OCI CLI list data in bash

Image
For automating tasks with OCI, you have a few options: OCI CLI (bash) Python SDK Go SDK Java SDK REST API I'm a bash first kinda guy, so would usually opt for trying with the bash solution if the requirement is simple enough. Anything beyond, it's worth moving over to Python or GO. When you run a command, you will typically get a JSON payload. But I'm in bash, how to I interact with this data? That's where this nice tool jq comes in. An interface to JSON data, where you can pass in a json path to get the data you want. When you get started with this you will want to leverage the website jqplay.org . It provides a visual interface to the query paths you build, along with some common examples. So, now over to iterating the data structure. I'm going to take the compartment list as an example. When calling the command: oci iam compartment list, the data set in my tenancy looks like this: { "data": [ { "compartment-id":

Oracle Cloud Infrastructure Cloud Shell - Here's what I discovered

Image
This week I spotted a new terminal-like icon at the top of my OCI tenancy. Upload clicking it, its a GCP-esque terminal emulator directly in the browser. I was doing some tweets about my discoveries, but thought I'd be a good idea to collate those in once place in a more consumable place. So, first I would say, it's possible you may not have it yet in your environment. At least for me, in my personal account, I do have it appearing. This was with a home region of Sydney. Once you launch the shell, type help and you will see a link to the official documentation. You can find it here: https://docs.cloud.oracle.com/en-us//iaas/Content/API/Concepts/cloudshellintro.htm Like in GCP, you get 5gb of storage. This will persist for at least 8 months. You get 6 months before OCI will email your tenant administrator and another 60 days after that before your data will be purged. So, a decent enough amount of time I would think. You can verify this with the command: df -h. On a fre

OCI CLI Environment Variables

The OCI CLI client provides a number of arguments that are useful as you look up your components from the command line. As you build an internal tooling to query either your or your customers resources, it can start to get "interesting" if you need to start building a custom argument list. Since version 2.6.9 of the client, a number of environment variables are supported that you can set rather than building a complex argument list. I think leveraging these variables makes for a cleaner code base in your bash scripts. If you check the release notes from version 2.6.9, you will see they introduced they following variables: OCI_CLI_PROFILE OCI_CLI_REGION OCI_CLI_USER OCI_CLI_FINGERPRINT OCI_CLI_KEY_FILE OCI_CLI_TENANCY OCI_CLI_ENDPOINT OCI_CLI_CONFIG_FILE OCI_CLI_RC_FILE OCI_CLI_CERT_BUNDLE OCI_CLI_AUTH OCI_CLI_DELEGATION_TOKEN_FILE OCI_CLI_SECURITY_TOKEN_FILE For the most recent version of what's supported, you can review the code base where they defi

OCI: Enabling X11 Forwarding on an Oracle Linux instance

Image
I was connecting to one of my works servers the other day hoping to copy the contents of a file into my clipboard, which would require the use of an X11 forwarded session, but as I connected to the server with X11 forwarding enabled, I was sad to see the following message: X11 forwarding request failed on channel 0 This is on Oracle Linux. Note, if I connect to an Ubuntu instance, I get the message: /usr/bin/xauth:  file /home/ubuntu/.Xauthority does not exist But this file is created, and X forwarding works from the get-go. OK, back to Oracle Linux - how do we fix this? Actually, the fix is a simple one. SSH is already configured to enable X11Forwarding. The other change you need make is to turn off the setting X11UseLocalhost. So part of your configuration would likely look like this: X11Forwarding yes #X11DisplayOffset 10 X11UseLocalhost no After that, you will want to reload the SSH daemon. Do this by running the command: sudo systemctl reload sshd Finally,

Trimming down on OCI CLI output with a query in the RC file

Oracle Cloud Infrastructure has a command client, which leverages their REST API. One thing you can do to streamline your usage is to make use of an RC file. The RC file that would be automatically used is the one at the path: `~/.oci/oci_cli_rc`, but you can also point to an alternative file path if you have named it something different. At the most basic level what you would typically want to do is provide some alias for arguments. A common argument being `--compartment-id`, but we can alias that to simply `-c` by specifying in our RC file: [OCI_CLI_PARAM_ALIASES] -c = --compartment-id This is all good, but what I think is neat is that you can provide queries to manipulate the output that is returned to the screen. What's a use case for this? Well one example, it's not uncommon to list the compartments so you can figure out the compartment ID, but by default there is a lot of information returned that I am almost never interested in. When your tenancy isn't very