Creating an Oracle REST Data Services Docker image

Oracle has added Oracle REST Data Services (ORDS) to the Docker build files family on GitHub, which means that you can now easily dockerize ORDS. If you don’t know yet what ORDS is, it’s a free technology from Oracle that allows you to REST-enable your Oracle databases. More specifically, with ORDS you can just fire off regular REST calls to modify or retrieve data from one or many Oracle databases without having to know how to write SQL; not that knowing SQL is a bad thing! ūüôā In modern application and microservices architectures REST has become more and more popular for exchanging information. ORDS enables you to easily exchange data from and to Oracle databases via REST without having to write lines and lines of code yourself.¬† For more information on what ORDS is and what it can do, check out Jeff Smith’s blog post about ORDS.

Continue reading “Creating an Oracle REST Data Services Docker image”

Enabling SFTP-only access on Linux

Recently I had the need to share a zip file with a bunch of people that was big enough not to fit into email anymore. So I wanted to get it onto my server so that folks could grab it via SFTP from there. SFTP is setup by default on my Linux environment, so them accessing the machine was trivial. However, I didn’t want to give them full access to the entire machine where they could randomly up- and download files anywhere. What I needed was some way of giving them a user which was self-contained, with no SSH privileges and bound to a single location on the filesystem. Luckily, setting something like this up was much easier than I thought, and here is how you can do it yourself. Note, all commands below are executed as the root¬†user:

tl;dr

  1. useradd <your sftp user> -s /sbin/nologin -M
  2. passwd <your sftp user>
    1. Enter your sftp user password and confirm
  3. vi /etc/ssh/sshd_config
  4. Match User <your sftp user>
       ChrootDirectory <your sftp user directory>
       ForceCommand internal-sftp
       AllowTcpForwarding no
       X11Forwarding no
    
  5. service sshd restart‚Äč

Continue reading “Enabling SFTP-only access on Linux”

Deploying a Kubernetes cluster with Vagrant on Virtual Box

Oracle has just included Kubernetes support for its VirtualBox Vagrant GitHub repository. With that it’s now easier than ever to get a Kubernetes cluster up and running inside VMs.¬†If you have not come across Vagrant yet, it’s a great tool by HashiCorp for “Development Environments Made Easy“.

tl;dr

  1. Install VirtualBox
  2. Install Vagrant
  3. Clone the GitHub repository git clone https://github.com/oracle/vagrant-boxes
  4. Change into the vagrant-boxes/Kubernetes folder
  5. Run vagrant up master; vagrant ssh master
  6. Within the master guest, run as root: /vagrant/scripts/kubeadm-setup-master.sh
    You will be asked to log in to the Oracle Container Registry
  7. Run vagrant up worker1; vagrant ssh worker1
  8. Within the worker1 guest, run as root: /vagrant/scripts/kubeadm-setup-worker.sh
    You will be asked to log in to the Oracle Container Registry
  9. Repeat the last 2 steps for worker2

Your cluster is ready!
Within the master guest you can check the status of the cluster, as the vagrant user, e.g.:

kubectl cluster-info
kubectl get nodes
kubectl get pods --namespace=kube-system

Continue reading “Deploying a Kubernetes cluster with Vagrant on Virtual Box”

Manually installing a Maven artifact in your local repository

I find myself once again in the situation that I have to install the Oracle JDBC driver into my local Maven repository. Usually this is easily accomplished via mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>, see Guide to installing 3rd party JARs for more details on that. However, this time I was thinking to go the extra mile and actually figure out a way of how to do it entirely manually. This comes in handy if you have, for example, Maven integrated in your IDE and the mvn binary not available to yourself in the command line.

Continue reading “Manually installing a Maven artifact in your local repository”

How to create small Docker images

Oracle_DockerWhen it comes to space efficiency Docker still isn’t quite as good as it could be. The layered filesystem used by Docker sometimes occupies more space than is really necessary. Over time, a couple of enhancements have made their way into Docker to allow the build of more space efficient images. The ADD¬†instruction for example is smart enough to detect (unfortunately only) local compressed archives (and unfortunately only identity, gzip,¬†bzip2 or xz but not zip¬†archives) and directly adds the uncompressed contents into the image, unlike the COPY¬†instruction that simply copies a file into the image. The downside of the latter is that space is occupied for the zip archive itself and the extracted contents of the archive, whereas the former will not occupy any space for the archive as it is never added into the image.

Continue reading “How to create small Docker images”