Death's Head Vs.... Han Solo

I genuinely expected Solo to be a load of old bollocks, it wasn’t as good as Rogue One but it was still better than the prequel trilogy that we don’t talk about.

Sorry that Death’s Head has a miserable head on that day.

Create MySQL users has changed

After all this time, the way of creating users and granting privileges on user in one statement just doesn’t work anymore. I guess I just missed the memo

New-MacBook-Pro:robl cex$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.15 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL ON robl.* to robl@localhost IDENTIFIED BY 'robl';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL 

Ok, so we need to create the user and then do the grant

mysql> CREATE USER robl IDENTIFIED BY 'robl';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL ON robl.* TO robl@localhost;
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> CREATE USER robl@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE USER robl@localhost iDENTIFIED BY 'robl';
ERROR 1396 (HY000): Operation CREATE USER failed for 'robl'@'localhost'
mysql> DROP USER robl;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER robl@localhost IDENTIFIED BY 'robl';
ERROR 1396 (HY000): Operation CREATE USER failed for 'robl'@'localhost'
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER robl@localhost IDENTIFIED BY 'robl';
ERROR 1396 (HY000): Operation CREATE USER failed for 'robl'@'localhost'
mysql> DROP USER robl;
ERROR 1396 (HY000): Operation DROP USER failed for 'robl'@'%'

Ok, let’s just start again.

mysql> DROP USER robl@localhost;
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER robl@localhost IDENTIFIED BY 'robl';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON robl.* TO robl@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> 

Ok, now I can get this started.

Ruby fuzzy matching

I am running through a data set which is lots of answers and trying to make the data consistent as human input is always going to be wonky from typos, spaces instead of hiphens to complete misspelling. Found this…

https://github.com/seamusabshere/fuzzy_match

2.3.3 :002 > require 'fuzzy_match'
=> true
2.3.3 :003 > fm = FuzzyMatch.new(['Uwe Rosenberg', 'X-Com'])
 =>#<FuzzyMatch:0x007ff02b05f370 @read=nil, @groupings=[], @identities=[], @stop_words=[], @default_options={:must_match_grouping=>false, :must_match_at_least_one_word=>false, :gather_last_result=>false, :find_all=>false, :find_all_with_score=>false, :threshold=>nil, :find_best=>false, :find_with_score=>false}, @haystack=[w("Uwe Rosenberg"), w("X-Com")]>
2.3.3 :004 > fm.find('Use Roenberb')
=> "Uwe Rosenberg" 

Perfect. Time to de-dupe some dodgy data.

Postgres isn't starting again

It’s just silently falling over and restarting when trying to start with brew services start postgresql

New-MacBook-Pro:local cex$ sudo -s tail -f /var/log/system.log
Password:
Feb 19 09:52:41 New-MacBook-Pro com.apple.xpc.launchd[1] (homebrew.mxcl.postgresql[27587]): Service exited with abnormal code: 1
Feb 19 09:52:41 New-MacBook-Pro com.apple.xpc.launchd[1] (homebrew.mxcl.postgresql): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Feb 19 09:52:51 New-MacBook-Pro com.apple.xpc.launchd[1] (homebrew.mxcl.postgresql[27616]): Service exited with abnormal code: 1

Starting manually and checking the server.log

New-MacBook-Pro:local cex$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
New-MacBook-Pro:local cex$ cat /usr/local/var/
cache/    db/       homebrew/ lib/      log/      mongodb/  mysql/    postgres/ run/      
New-MacBook-Pro:local cex$ cat /usr/local/var/postgres/server.log 
2019-02-19 10:00:29.473 GMT [30912] FATAL:  database files are incompatible with server
2019-02-19 10:00:29.473 GMT [30912] DETAIL:  The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.1.

Ok, so data dir is incompatible. Damn. Hopefully I can just upgrade the data files with brew postgresql-upgrade-database

New-MacBook-Pro:local cex$ brew postgresql-upgrade-database
==> brew install postgresql@10
==> Downloading https://homebrew.bintray.com/bottles/postgresql@10-10.6_1.mojave.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring postgresql@10-10.6_1.mojave.bottle.1.tar.gz
==> /usr/local/Cellar/postgresql@10/10.6_1/bin/initdb /usr/local/var/postgresql@10
==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
  brew postgresql-upgrade-database

postgresql@10 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have postgresql@10 first in your PATH run:
  echo 'export PATH="/usr/local/opt/postgresql@10/bin:$PATH"' >> ~/.bash_profile

For compilers to find postgresql@10 you may need to set:
  export LDFLAGS="-L/usr/local/opt/postgresql@10/lib"
  export CPPFLAGS="-I/usr/local/opt/postgresql@10/include"

For pkg-config to find postgresql@10 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/postgresql@10/lib/pkgconfig"


To have launchd start postgresql@10 now and restart at login:
  brew services start postgresql@10
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgresql@10 start
==> Summary
   /usr/local/Cellar/postgresql@10/10.6_1: 1,706 files, 20.8MB
==> Upgrading postgresql data from 10 to 11...
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
waiting for server to start....2019-02-19 10:05:34.199 GMT [32604] LOG:  listening on IPv6 address "::1", port 5432
2019-02-19 10:05:34.199 GMT [32604] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2019-02-19 10:05:34.200 GMT [32604] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-02-19 10:05:34.219 GMT [32605] LOG:  database system was shut down at 2019-02-07 21:30:24 GMT
2019-02-19 10:05:34.223 GMT [32604] LOG:  database system is ready to accept connections
 done
server started
waiting for server to shut down....2019-02-19 10:05:34.362 GMT [32604] LOG:  received fast shutdown request
2019-02-19 10:05:34.362 GMT [32604] LOG:  aborting any active transactions
2019-02-19 10:05:34.363 GMT [32604] LOG:  worker process: logical replication launcher (PID 32611) exited with exit code 1
2019-02-19 10:05:34.363 GMT [32606] LOG:  shutting down
2019-02-19 10:05:34.369 GMT [32604] LOG:  database system is shut down
 done
server stopped
==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old...
The files belonging to this database system will be owned by user "cex".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/local/opt/postgresql/bin/pg_ctl -D /usr/local/var/postgres -l logfile start

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok
Creating script to delete old cluster                       ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh
==> Upgraded postgresql data from 10 to 11!
==> Your postgresql 10 data remains at /usr/local/var/postgres.old
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

Fortunately that seems to have worked.

Adding helpers for RSpec memoization

I thought initially it would be incredibly easy to add a wrapper method alongside existing let, let!, subject memoized helper methods in RSpec.

def current_user(&block)
    u = yield
    allow(User).to receive(:current_user).and_return(u)
  end

  describe 'stuff' do
    let(:artist) { Fabricate(:artist) }
    current_user { artist.user }
  end

But I kept getting. `artist` is not available on an example group when the current user block was yielded. I had to dig into RSpec::Core to find how let is defined and came up with and ensure that artist and current_user were in the same scope when calling one another.

module CurrentUserHelpers
  extend ActiveSupport::Concern

  module ClassMethods
    def current_user(&block)
      raise "#current_usercalled without a block" if block.nil?
      RSpec::Core::MemoizedHelpers.module_for(self).__send__(:define_method, :current_user, &block)

      # Apply the memoization. The method has been defined in an ancestor
      # module so we can use `super` here to get the value.
      define_method(:current_user) do
        u = __memoized.fetch_or_store(:current_user) do
          block.arity == 1 ? super(RSpec.current_example, &nil) : super(&nil)
        end
        allow(User).to receive(:current_user).and_return(u)
        u
      end
    end

    def current_user!(&block)
      current_user(&block)
      before { current_user }
    end
  end
end

Bugs that happen in Continuous Integration but not local

Your CI environment probably doesn’t mirror your development setup 100% of the time. So when stuff spectactularly fails testing elsewhere and not locally you might be tempted to throw your laptop in the bin.

81) BLAH
      Got 0 failures and 2 other errors:

      81.1) Failure/Error: BLAH
            
            IOError:
              closed stream
            # ./vendor/bundle/ruby/2.3.0/gems/aws-sdk-core-3.46.0/lib/seahorse/client/net_http/patches.rb:29:in `block in new_transport_request'
            # ./vendor/bundle/ruby/2.3.0/gems/aws-sdk-core-3.46.0/lib/seahorse/client/net_http/patches.rb:28:in `catch'
            # ./vendor/bundle/ruby/2.3.0/gems/aws-sdk-core-3.46.0/lib/seahorse/client/net_http/patches.rb:28:in `new_transport_request'
            # ./vendor/bundle/ruby/2.3.0/gems/fakeweb-1.3.0/lib/fake_web/ext/net_http.rb:50:in `request_with_fakeweb'
            # ./vendor/bundle/ruby/2.3.0/gems/webmock-3.0.1/lib/webmock/http_lib_adapters/net_http.rb:97:in `block in request'
            # ./vendor/bundle/ruby/2.3.0/gems/webmock-3.0.1/lib/webmock/http_lib_adapters/net_http.rb:110:in `block in request'
            # ./vendor/bundle/ruby/2.3.0/gems/webmock-3.0.1/lib/webmock/http_lib_adapters/net_http.rb:109:in `request'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/http/default.rb:121:in `response_for'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/http/default.rb:76:in `request'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/http/common.rb:62:in `call'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/bridge.rb:166:in `execute'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/oss/bridge.rb:584:in `execute'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/oss/bridge.rb:50:in `get'
            # ./vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/common/navigation.rb:30:in `to'
            # ./vendor/bundle/ruby/2.3.0/gems/capybara-3.10.1/lib/capybara/selenium/driver.rb:46:in `visit'
            # ./vendor/bundle/ruby/2.3.0/gems/capybara-3.10.1/lib/capybara/session.rb:265:in `visit'
            # ./vendor/bundle/ruby/2.3.0/gems/capybara-3.10.1/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
            # ./vendor/bundle/ruby/2.3.0/gems/rspec-rails-3.8.0/lib/rspec/rails/example/feature_example_group.rb:29:in `visit'

BackboneJS, Rails 5

Basic Backbone scaffold, but….where the hell has this indentation error come from?

Showing /Users/cex/repos/robl/app/views/layouts/application.html.haml where line #7 raised:

SyntaxError: [stdin]:4:9: unexpected indentation
Rails.root: /Users/cex/repos/robl

Application Trace | Framework Trace | Full Trace
(execjs):7539:8
(execjs):7545:14
(execjs):1:102
app/views/layouts/application.html.haml:7:in `_app_views_layouts_application_html_haml__3268572193542758911_70297544684220'
config/initializers/cookies.rb:10:in `call'

Precompiling Javascript and CSS in magic, but then then Javascript bugs like this appear after running a scaffold generator which spits out 20 files then this is frustrating. A stray object which should have had some nested attributes, was just left hanging.

blah:
// should have been
blah: {}

If only it could have pointed me to the right file, rather than just a line/char in some file. Next up. How does the default Backbone scaffold cope with MongoDB → JSON objects that don’t have a standard ‘id’.

Elixir: what is a cat?

I like cats, but what are they made of?

Robs-iMac:hello roblacey$ iex
Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 'cat'
'cat'
iex(2)> Enum.to_list 'cat'
'cat'
iex(3)> [head | tail] = 'cat'
'cat'
iex(4)> head
99
iex(5)> tail
'at'

Ok, so Single-quoted strings are really lists of characters. Double-quoted strings are not.

iex(6)> Enum.to_list "cat"   
** (Protocol.UndefinedError) protocol Enumerable not implemented for "cat"
    (elixir) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir) lib/enum.ex:141: Enumerable.reduce/3
    (elixir) lib/enum.ex:2979: Enum.reverse/1
    (elixir) lib/enum.ex:2613: Enum.to_list/1

Rails 5.1 testing

Today I got almost 300 spec errors when flipping our core app to use Rails 5.1. Why? Well, it’s just syntax in controller, request specs but the syntax makes things much clearer and is probably a welcome change if not a time consuming fix.

get :show, { :id => 1 }, { 'HTTP_REFERER' => '/something' }
get :show, params: { :id => 1 }, headers: { 'HTTP_REFERER' => '/something' }

Now XHR requests are being wonky.

xhr :show, params: { :id => 1 }
     NoMethodError:
       super: no superclass method `xhr' for #<RSpec::ExampleGroups

Ok that’s make sense.

get :show, :xhr => true, params: { :id => 1 }

Playing with Phoenix Server

Upgrade Phoenix server.

Robs-iMac:repos roblacey$ mix archive.install hex phx_new 1.4.0
Resolving Hex dependencies...
Dependency resolution completed:
New:
  phx_new 1.4.0
* Getting phx_new (Hex package)
All dependencies up to date
Compiling 10 files (.ex)
Generated phx_new app
Generated archive "phx_new-1.4.0.ez" with MIX_ENV=prod
Are you sure you want to install "phx_new-1.4.0.ez"? [Yn] Y
* creating /Users/roblacey/.mix/archives/phx_new-1.4.0

Generate the application.

Robs-iMac:repos roblacey$ mix phoenix.new hello
* creating hello/config/config.exs
* creating hello/config/dev.exs
* creating hello/config/prod.exs
* creating hello/config/prod.secret.exs
* creating hello/config/test.exs
* creating hello/lib/hello.ex
* creating hello/lib/hello/endpoint.ex
* creating hello/test/views/error_view_test.exs
* creating hello/test/support/conn_case.ex
* creating hello/test/support/channel_case.ex
* creating hello/test/test_helper.exs
* creating hello/web/channels/user_socket.ex
* creating hello/web/router.ex
* creating hello/web/views/error_view.ex
* creating hello/web/web.ex
* creating hello/mix.exs
* creating hello/README.md
* creating hello/web/gettext.ex
* creating hello/priv/gettext/errors.pot
* creating hello/priv/gettext/en/LC_MESSAGES/errors.po
* creating hello/web/views/error_helpers.ex
* creating hello/lib/hello/repo.ex
* creating hello/test/support/model_case.ex
* creating hello/priv/repo/seeds.exs
* creating hello/.gitignore
* creating hello/brunch-config.js
* creating hello/package.json
* creating hello/web/static/css/app.css
* creating hello/web/static/css/phoenix.css
* creating hello/web/static/js/app.js
* creating hello/web/static/js/socket.js
* creating hello/web/static/assets/robots.txt
* creating hello/web/static/assets/images/phoenix.png
* creating hello/web/static/assets/favicon.ico
* creating hello/test/controllers/page_controller_test.exs
* creating hello/test/views/layout_view_test.exs
* creating hello/test/views/page_view_test.exs
* creating hello/web/controllers/page_controller.ex
* creating hello/web/templates/layout/app.html.eex
* creating hello/web/templates/page/index.html.eex
* creating hello/web/views/layout_view.ex
* creating hello/web/views/page_view.ex

Fetch and install dependencies? [Yn] Y
* running mix deps.get
* running npm install && node node_modules/brunch/bin/brunch build

We are all set! Run your Phoenix application:

    $ cd hello
    $ mix phoenix.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phoenix.server

Before moving on, configure your database in config/dev.exs and run:

    $ mix ecto.create

Looks like I had already created a database.

Robs-iMac:hello roblacey$ mix ecto.create
warning: found quoted keyword "test" but the quotes are not required. Note that keywords are always atoms, even when quoted, and quotes should only be used to introduce keywords with foreign characters in them
  mix.exs:52

Compiling 12 files (.ex)
Generated hello app
The database for Hello.Repo has already been created

So apparently Phoenix is super fast, scary fast. Well let’s see with ab 10 concurrent requests (longest request is 144ms)

Robs-iMac:hello roblacey$ ab -n 10 -c 10 http://phoenix.dv/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking phoenix.dv (be patient).....done


Server Software:        Cowboy
Server Hostname:        phoenix.dv
Server Port:            80

Document Path:          /
Document Length:        1931 bytes

Concurrency Level:      10
Time taken for tests:   0.059 seconds
Complete requests:      10
Failed requests:        0
Total transferred:      22600 bytes
HTML transferred:       19310 bytes
Requests per second:    169.19 [#/sec] (mean)
Time per request:       59.105 [ms] (mean)
Time per request:       5.910 [ms] (mean, across all concurrent requests)
Transfer rate:          373.41 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:     8   16  10.7     13      46
Waiting:        7   16  10.6     13      45
Total:          8   16  10.6     13      46

Percentage of the requests served within a certain time (ms)
  50%     13
  66%     13
  75%     13
  80%     14
  90%     46
  95%     46
  98%     46
  99%     46
 100%     46 (longest request)

1000 concurrent requests, 144ms

Robs-iMac:hello roblacey$ ab -n 1000 -c 1000 http://localhost:4000/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Cowboy
Server Hostname:        localhost
Server Port:            4000

Document Path:          /
Document Length:        1931 bytes

Concurrency Level:      1000
Time taken for tests:   0.152 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      2260000 bytes
HTML transferred:       1931000 bytes
Requests per second:    6569.65 [#/sec] (mean)
Time per request:       152.215 [ms] (mean)
Time per request:       0.152 [ms] (mean, across all concurrent requests)
Transfer rate:          14499.43 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   36  11.8     35      55
Processing:    25   64  16.7     69      90
Waiting:        6   64  16.8     69      90
Total:         46  100  24.2    103     144

Percentage of the requests served within a certain time (ms)
  50%    103
  66%    115
  75%    121
  80%    124
  90%    131
  95%    136
  98%    140
  99%    142
 100%    144 (longest request)

10,000 requests, Ok so I get a socket error. Too many open files (24) That’s ok, I’m not at that stage yet anyway.

Robs-iMac:hello roblacey$ ab -n 10000 -c 10000 http://localhost:4000/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
socket: Too many open files (24)

So that’s pretty fast, but that’s just a static page. This would be better tested with a page that does a little more, or an API request that reads from the database.

Lastly just adding a new route, controller and view and template for a /hello

diff --git a/web/controllers/hello_controller.ex b/web/controllers/hello_controller.ex
new file mode 100644
index 0000000..f3e97b4
--- /dev/null
+++ b/web/controllers/hello_controller.ex
@@ -0,0 +1,7 @@
+defmodule Hello.HelloController do
+  use Hello.Web, :controller
+
+  def index(conn, params) do
+    render(conn, "world.html")
+  end
+end
diff --git a/web/router.ex b/web/router.ex
index e7a505b..6df752f 100644
--- a/web/router.ex
+++ b/web/router.ex
@@ -15,7 +15,7 @@ defmodule Hello.Router do
 
   scope "/", Hello do
     pipe_through :browser # Use the default browser stack
-
+    get "/hello", HelloController, :index
     get "/", PageController, :index
   end
 
diff --git a/web/templates/hello/world.html.eex b/web/templates/hello/world.html.eex
new file mode 100644
index 0000000..e69de29
diff --git a/web/views/hello_view.ex b/web/views/hello_view.ex
new file mode 100644
index 0000000..00f1881
--- /dev/null
+++ b/web/views/hello_view.ex
@@ -0,0 +1,3 @@
+defmodule Hello.HelloView do
+  use Hello.Web, :view
+end

Intriguing.