Mounting Windows File Shares in Docker

A network graph on top of an image of shipping containers

I recently had the need to mount a Windows network file share location within a Docker container. Thus, I tested the mounting of the share on my local machine. It worked, so I figured I’d simply set up the container to mimic the steps I took to mount the share on the host machine. Unfortunately, it wasn’t as straightforward as that. However, I was able to achieve the mount, and this post explains the steps I took to achieve the mount.

Continue reading

Redirect Apache Requests to Applications

When requests come into the Apache Web server, they are routed by default to the files in the Document Root. Sometimes we want to redirect those requests elsewhere. We can do this with the Rewrite module.

Add the Rewrite directives to the Apache config file, an .htaccess file, or do what I usually do and add it to the Virtual Host file.

Rewrite for SPAs

To direct requests to Single Page Web-apps, such as those that are build with React and Vue.js. This is what works for me.

<Directory "/var/www/my-app/dist">
Options Indexes FollowSymLinks
order allow,deny
allow from all

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
</Directory>

PHP Applications

Often when using Apache to host a PHP Web application, it’s desirable to handle incoming requests with PHP. By default, Apache will try to handle requests. But, we can use the rewrite module to send requests to specified PHP scripts.

<Directory "/path/to/webroot">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?/$1 [L]
</Directory>

Maven – Compiling JAR with Dependencies

Although I’m familiar with Java, I don’t use it day-to-day. To keep current with arguably the worlds most popular programming language, I decided to use Java in a project that I’m working on in my off hours. In that project (which gathers and analyzes economic data) I decided to use Maven. Even-though my small project doesn’t necessitate the need for such a tool, Maven implements many industry best practices (or at least promises to do so). So, I figured that it would be worth while to learn to use it.
Continue reading