Skip to main content


Showing posts from 2018

code snippets we love @ Universal Equations: Setting Environment Variables Programmatically (Java)

code snippets we love @ Universal Equations(
Setting Environment Variables Programmatically (Java)
public static void setEnv(Map<String, String> newenv) { try { Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment"); theEnvironmentField.setAccessible(true); Map<String, String> env = (Map<String, String>) theEnvironmentField.get(null); env.putAll(newenv); Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment"); theCaseInsensitiveEnvironmentField.setAccessible(true); Map<String, String> cienv = (Map<String, String>) theCaseInsensitiveEnvironmentField.get(null); cienv.putAll(newenv); } catch (NoSuchFieldException e) { try { Class[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.gete…

A Tale of Two Log Forwarders: Logstash and FluentD (part 1.2)

A couple of ways to install Logstash is as a service on the cloud virtual machine, as well as deployed as a Docker container.  For our example, let's deploy Logstash as a Docker container. Assuming the Docker engine in installed, we can pull it from the repository: docker pull   You can execute the "docker image" command to verify the image was pulled.  Before we create a container from this image, we'll create a configuration file.   It is possible to have multiple inputs on a single Logstash configuration file, but let us, for this example, have one configuration file  per input. vim tcp-to-elasticsearch.conf input {   tcp { port => 8080   } } output {   elasticsearch { hosts => [""]   }   stdout {

Oracle NoSQL Database meets Elasticsearch (part 1.1)

The Oracle NoSQL Database is a scalable, distributed low latency NoSQL database built on Oracle Berkeley DB Java Edition.  Its Docker image can be pulled and run with no changes needed to the Dockerfile. With that being said, we can have an Oracle NoSql Docker container up and running with the following command: docker run --restart=always -dit --name=nosqlce \ -p 5000-5020:5000-5020 oracle/nosql   To verify the container, you can use a 'docker logs' command.  if you're still not convinced, you can use a 'docker exec' command, utilizing kvstore.jar, similar to the following: docker exec -it nosqlce java -Xmx256m -Xmx256m \ -jar /kv-4.3.11/lib/kvstore.jar status -root /kvroot   Here, the root parameter is required.   Hopefully, this command returns a status of 'RUNNING.'  The reason for the '-Xmx256m -Xms256m' settings it's generally a best practice to keep heap usage low for administrative tasks.  if you get curious about the other utility comman…

Installing Drupal 7 on Oracle Linux 7 (Part 1.2)

Now, let's see if we can put together a docker command that will get our MySQL container up and running.  First, let's create a volume for our MySQL instance.

        docker volume create --name mysql_volume

    The following command, then, should create an instance of a MySQL container with a drupal database created on startup.

        docker run --restart=always -d -name mysql -p 3306:3306 \
        -e MYSQL_DATABASE=drupal \
        -e MYSQL_USER=drupal \
        -e MYSQL_PASSWORD=+3fRExawr7fu \
     -v mysql_volume:/var/lib/mysql \

    After giving it a moment to get going, the 'docker ps' command should give us the status of our new container.

    We'll also want to execute a 'docker logs' command to get out temporary MySQL password.

     #docker logs mysql

    Next, in order to more easily handle the administration of our MySQL Server, we can run phpmyadmin( as a Docker container that's linked …

Installing Drupal 7 on Oracle Linux 7 (Part 1.1)

To install Drupal 7 from its yum repository, you may need to enable the ol7_developer_EPEL repo.  If yum-utils is installed, you can use the yum-config-manager command to do this (you may have to use sudo).

#    yum install yum-utils
#    yum-config-manager --enable ol7_developer_EPEL

    Once you have the repo installed, it's, then, just a matter of installing it from there:

#  yum install drupal7

    This command will install Drupal 7 in the /usr/share/drupal7 directory.

    It will install the Apache HTTP 2.4 web server, but you'll have to install your database separately if it is not installed already.

    Assuming a database has not been installed, we have many options to set one up.  For this installation, I chose to run MySQL as a Docker container.  I took this approach so we can use Docker environment variables to automate the creation of a Drupal database.

    The Github link to the MySQL container I used is:

    The …