Categories
coding development

Design x Metatooth r9

Release 9 of Design x Metatooth has been published!

Design x Metatooth r9

Design x Metatooth (pronounced “design by metatooth”) is a web-based 3D modeling application. Release 9 has now been published, check it out at design.metatooth.com

Release 9 adds Pick, Draw, Undo, and Redo functionality to the basic View (Rotate + Zoom) & Measure capabilities. On screen help is non-existent, please refer to the user documentation below.

User Documentation

Resize your browser width to 1000 pixels or more to access the menu bar.

Throughout, you may adjust the zoom using your mouse’s scroll wheel or middle button. Use the buttons along the menu bar to switch modes or issue commands. The keyboard shortcut for the mode/command is displayed to the right of the button name.

Rotate View – Press r to return to this rotate view mode. Rotate with the primary (typically left) button.
Measure – Press m to switch to measure mode. Click and drag with the primary button to get the 2D or point-to-point distance between two locations on screen. The measure tool can be reset any time within this mode. Switching to a different mode will remove the measure tool from the screen.
Pick – Press p to switch to the pick mode. Single click with the primary button to mark the intersection point below the cursor.
Draw – Press d to switch to the draw mode. Click and drag with the primary button to mark a line on the target mesh.
Undo – This command’s keyboard shortcut is z. Undo will remove the last object (pick point or line) made. Undo is available in Rotate View, Pick, and Draw modes.
Redo – This command’s keyboard shortcut is y. Redo will recover the last object removed by the undo command. Redo is available in Rotate View, Pick, and Draw modes.
Download – The download button in the upper right can be used to save the visible mesh to disk as a Binary STL file.

Categories
coding development

Design x Metatooth r8

Design x Metatooth r8

Design x Metatooth is a web-based 3D modeling application. Check it out for yourself at design.metatooth.com! r8 adds Measure functionality to the basic View (Rotate + Zoom) capabilities. On screen help is non-existent, refer to the user documentation below.

User Documentation

Resize your browser width to 1000 pixels or more to access the menu bar.

View – Press ‘v’ to return to view mode. Zoom with the scroll wheel or middle button. Rotate with the primary (typically left) button.
Measure – Press ‘m’ to switch to measure mode. Click and drag with the primary button to get the 2D or point-to-point distance between two locations on screen.
Download – The download button in the upper right can be used to save the visible mesh to disk as a Binary STL file.

Categories
coding

NGINX Heroku WordPress

NGINX, Heroku, and WordPress combined. This website is powered by WordPress on Heroku. Details on configuration are here.

My next #DevOps task is to add NGINX in front of the WordPress application. In the future, this could be used as a load balancer. Until then, NGINX will reverse proxy the requests to the Heroku application instance.

To start, I spun up a virtual machine running Ubuntu on Amazon’s EC2. Check out how to install and configure NGINX here. Make sure to open your firewall to HTTP & HTTPS traffic!

I encountered two major issues:

  1. The request passed by NGINX through the reverse proxy was not being understood by Heroku’s application stack.
  2. Once the application stack properly handled the request, WordPress’s response triggered a redirect loop.

Reverse Proxy

Heroku’s stack uses the host of the request to route to the appropriate application instance. The originating Host value is (in my example) ‘wwww.metatooth.com’. Heroku shouldn’t respond to this. Turn off the app’s Custom Domain feature if it does. Update the reverse proxy to set a new Host header that Heroku will respond to.

server {
    server_name www.metatooth.com;

    location / {
        proxy_pass https://calm-waters-18762.herokuapp.com;
        proxy_set_header Host calm-waters-18762.herokuapp.com;
    }

    # configure SSL here
}

Redirect Loop

Setting the Host request header got Heroku’s attention, now WordPress responds to that request with a redirect loop. I encountered this problem while trying to configure an HTTPS-only WordPress installation. The way out of the redirect loop was to update two more request headers and then to use those headers in the WordPress configuration. Here’s the new section of wp-config.php

 
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
{
        $_SERVER['HTTPS']       = 'on';
        $_SERVER['SERVER_PORT'] = '443';
        define('FORCE_SSL_ADMIN', true);
}

if ( isset($_SERVER['HTTP_X_FORWARDED_HOST']) ) {
        $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}

That gets WordPress to not redirect to https on these proxied requests, but only if the request headers of X-Forwarded-Proto and X-Forwarded-Host are specified. The NGINX configuration now is:

server {
    server_name www.metatooth.com;

    location / {
        proxy_pass https://calm-waters-18762.herokuapp.com;
        proxy_set_header Host calm-waters-18762.herokuapp.com;
        proxy_set_header X-Forwarded-Host $host;    
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # configure SSL here
}

That’s how I got NGINX, Heroku, and WordPress to play well together. Next task is to use an upstream for the proxy_pass directives. What’s your infrastructure layout and what did you learn along the way? Tell me about it in the comments!

Categories
coding

Docker Ubuntu 19.04

Docker on Ubuntu 19.04 is a cinch. “Dockerizing” an application is a great way to ensure you understand it’s dependencies. I always forget this last bit when setting up a new machine.

sudo usermod -aG docker username

Otherwise, I recommend this Medium post by Grigor Khachatryan.

https://medium.com/@Grigorkh/how-to-install-docker-on-ubuntu-19-04-7ccfeda5935

It turns out that LAMP Ubuntu 19.04 is the most popular Metatooth blog post. Can’t argue with success. More #DevOps posts forthcoming! I’ll certainly keep posting about teeth and technology, too.

What other “crowdsourced” finding has surprised you recently? Tell me about it in the comments!

 

Categories
coding

LAMP Ubuntu 19.04

LAMP on Ubuntu 19.04 should be a snap, and it is. If you install all the packages! I was missing libapache2-mod-php and php-mysql. Here’s the blog post that helped me out.

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04

LAMP starts with Linux

Ubuntu 19.04 also provides a meta-package for this.
sudo apt-get install lamp-server^ will install all dependencies, and give instructions for enabling PHP under Apache2. Mind the trailing caret (^)! This meta-package selects MySQL 5.7 over MariaDB 10.3. A brief search indicates this is the best choice.

 

Why am I doing this? In order to have a development environment for this WordPress 5 website. WordPress is widely used, but is not this developer’s cup of tea. However, it does have a strong community and it’s development is ongoing, so time to get on the bandwagon. Or at least use a staging methodology to push changes to www.metatooth.com.

My first website was of the LAMP variety. I guess 20 years is not that long for a platform’s life-cycle. What platform’s longevity surprises you? Tell me about it in the comments!

Categories
coding

JavaScript

It’s a bit ironic that I spend so much time with JavaScript right now. My first programming gig was with JavaScript. It was the spring of 2000. I was placed by an agency at an office near Alewife. I walked to Central, took the T to Harvard, got off, bought the “Rhino” book at the Harvard Book Store, got back on, and read the book until Alewife. I walked into the office and started coding. The company published training materials. A colleague (worker?) in the office said about 11am, “Hey, you need to take your eyes off the screen every now and then!”.

It was a bit of a disaster but I delivered the software they needed. I even partook of a company-provided yoga class. I ran into the co-worker a few years hence, and he claimed they still used the software I developed!

Your code is not temporary. Tell me about it in the comments.