Welcome!
Let’s get started…
Kurtis Holsapple
Owner/Operator of Open Function Computers, LLC
kurtis@openfunctioncomputers.com�
@ofcopdx�@lapubell��https://github.com/lapubell�https://github.com/open-function-computers-llc�
Let me tell you a story...
Oh, you want changes? Ok, let’s find out some things...
What we found: 🤦
Server issues
App issues
Possible Abstractions
What we found: 🤦
Server issues
App issues
Possible Abstractions
Let’s get to work! 🔨
Except, no.
so many issues...
How should we move forward? 🤔
There is a lot to consider.�Rebuild vs. refactor?
Ditch the project vs. continue down the rabbit hole?
Budget and timeline constraints?
If we can’t easily fix it, can we avoid it?
Server issues
Possible Abstractions
How do we catch only what we want?
New App
Conditional traffic flow
Prod App
REQUEST
RESPONSE
?
Do something besides
$response->send()
Two possible solutions
📞
🤝
Either way, we want to log the routes that aren’t caught by the new app and slowly transition them to the new application
📞 Solution
STEP 1:
Instead of showing 404 page, log the requested route
STEP 2:
Request same route from old app
(guzzle, cURL, etc...)
STEP 3:
Return response from old app, even if it’s a 404 there too
📞 Solution
New App Server
Prod App Server
REQUEST:
GET /hello.htm HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.coolapp.biz
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
REQUEST:
GET /hello.htm HTTP/1.1
User-Agent: Mozilla/4.0 (compatible;
Host: www.coolapp.biz
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
404!
RESPONSE:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Hello!</title>
<meta charset="utf-8">
...
RESPONSE:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Hello!</title>
<meta charset="utf-8">
...
🚧 AUTH! 🚧
📞 Solution
It’s like security is important or something
PHP session accessed via 🍪
📞 Solution
After authenticating the user on the new app, send the same credentials to the old app. Capture the old app’s cookie, and use it whenever requesting data from the old app.
📞 Solution
New App Server
Prod App Server
REQUEST:
POST /auth/login HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.coolapp.biz
Content-Type: application/x-www-form-urlencoded
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
username=root&password=secret
RESPONSE:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Hello!</title>
<meta charset="utf-8">
...
RESPONSE:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Hello!</title>
<meta charset="utf-8">
...
REQUEST:
POST /auth/login HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.coolapp.biz
Content-Type: application/x-www-form-urlencoded
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
username=root&password=secret
🍪
PRO TIP!
📞 Solution
Dockerize that old thing and serve it at a weird port, and now it won’t conflict with the new app running on the same machine with standard ports. Network latency is way smaller if served on the same machine!
🤝 Solution
Need to make sure things run on the same system
🤝 Solution
Research time
7.1!
🎉
We now have our dream environment! Automate it?
🤝 Solution
Server issues
Here’s what we did�(both apps need to be the same language):
🤝 Solution
STEP 1:
Instead of showing 404 page, log the requested route
STEP 2:
Bootstrap old app, handle that response inline
STEP 3:
Return response from old app, even if it’s a 404 there too
🤝 Solution
This line appears to do the heavy lifting
🤝 Solution
We got lucky
🤝 Solution
Where we started
FTP/SSH🤞
Our Current Scenario
git push
Run tests
One quick note
WRITE BROWSER TESTS!
Fun Stuff
Attributions:
Fun Stuff
I’m not affiliated, paid by, employed by, or in any other way connected�to any of the tools or companies discussed in this talk, but there is this:
Time for Q/A?
Wanna see a demo?