Repository navigation
Closed
Labels
Description
It's becoming untenable to deploy via github pages with submodules but no build step and server logic.
- Firepad past v1.0.0 doesn't include pre-built
dist/firepad.js. Need a build step. - GH Pages has no HTTPS (Security: HTTPS #6)!
- I need server-side reconstruction of firepad text for JS-free clients, notably search engines (Spiderable documents (content in HTTP response) #7).
- I need server-side pandoc for export (Export (.tex, .pdf, others) #33).
- Firebase JS api is no longer FOSS licensed (was a mistake) and while it's unclear if there is any practical problem, having submodule/bower/CDN flexibility might help.
My ideal would be something that can run any commit from anybody's fork.
Ideally, user should be able to switch code version via cookie without changing document URLs.
Think Rawgit + build transforms (like https://github.com/jesusabdullah/browserify-cdn) + containerized execution of server code.
The last part is hardest. I think the practical approach is layered:
- Host server-side code(s) on Heroku - easy for deploy via Heroku Button.
- Generic firepad->HTML gateway, with parametrized firepads location and output template - so you can use on anybody's firebase, and switch surrounding design & javascript without re-launching the gateway. As long as firepad format is stable, you don't really need to fork the gateway. (famous non-last words?)
- Generic hosted pandoc, allowing client-specified
markdown+foo-bardialects and filters (either server->json->client javascript->json->server, or Lua filters). - Hosted Javascript build, preferably on-demand a-la browserify-cdn but could also be via commit hook->CI->storage/CDN. Perhaps "deploy" builds to a derived Git repo that can be consumed as a submodule (whatever people say I like submodules).
Activity
cben commentedon Oct 3, 2014
However, it's possible to just move now to Heroku, then improve piece-wise.
The main mental block is I'm loath to lose Rawgit ability to link to any version, but Rawgit doesn't (yet) work on mathdown due to submodules anyway.
(Also, I've been lazy to use any deploy beyond git push, but my push-without-testing license shoud be revoked anyway, and
git push herokuis just as easy.)cben commentedon Jan 26, 2015
In progress: now works on https://mathdown.herokuapp.com and https://mathdown-cben.rhcloud.com.
Going to use Heroku for now (but keep ability to run off GH Pages)
cben commentedon Jan 29, 2015
Problem: Heroku's free 1-dyno per app idles when it gets 0 traffic for a hour.
It wakes up automatically but it takes about 10 seconds:
320 ms First Byte Time http://www.webpagetest.org/performance_optimization.php?test=150129_3E_R06&run=1&cached=0 (running)
vs
12621 ms First Byte Time http://www.webpagetest.org/performance_optimization.php?test=150128_R0_Q9E&run=1&cached=0 (sleeping)
Optimizing startup time is out of my hands.
npm startto first byte takes 500~600ms on my machine, according to:(using
tsfrom moreutils. Ctrl+C after it's done.)I suppose a smaller slug might help but ~10sec heroku wakeup is quoted widely so I don't expect there is much to win.
Paying: $35/mo for a dyno would give me 2 dynos and neither would idle.
But together with $20/mo for custom-domain SSL endpoint it's quite pricey...
=> I'm thinking moving off Heroku to a docker setup on a Digital Ocean box. $5~10 should be enough, including SSL.
cben commentedon Feb 9, 2015
Turns out the "free" Openshift plan also idles, and waking up felt way slower than 10sec.
The "bronze" plan (credit card but starts from $0) never idles [https://www.openshift.com/products/pricing].
Too bad their UI refuses to let me upgrade to bronze...
cben commentedon Feb 9, 2015
Yay, bronze plan worked now.
cben commentedon Feb 10, 2015
cben commentedon Feb 13, 2015
Uh-oh: warning in Openshift console:
Warning: Gear 546a6d7e5973cac907000028 is using 95.6% of inodes allowedcben commentedon Feb 13, 2015
Heroku broke: lots of 404 - apparently for everything in submodules.
I don't remember explicitly pushing to Heroku since it worked, so suspect Heroku's auto-pull from gh-pages...
cben commentedon Feb 14, 2015
=> Yes, git push to heroku works, auto sync from github breaks submodules.
=> Pushed manually and https://mathdown.herokuapp.com works now; disabled auto sync.
Heroku doesn't exactly document this, but https://devcenter.heroku.com/articles/git-submodules says:
I just made an unrelated commit to github, which triggered this in
heroku logs:so it's plausible that "Builds created with the API do not resolve submodules." applies...
Although then I did a git push to Heroku, which also looks like "heroku[api]" in the logs.
A direct manual push prints this to my terminal:
Sadly neither
heroku logsnor logs in heroku's dashboard have a trace of resolving submodules."Build log" in the dashboard begins from the
-----> Node.js app detected.The only difference between Build log of auto sync from github vs Build log of git push to heroku is:
vs
P.S. This wouldn't happen if testing used immutable infrastructure in the Right way:
create new heroku app, run tests against it, if successful "deploy" by pointing to new app.
Actually heroku supports "forking" apps and I suspect there are solutions to do exactly this.
cben commentedon Feb 15, 2015
Back to Openshift quota issue.
Following https://help.openshift.com/hc/en-us/articles/202399760-Disk-Quota-Exceeded-Now-What- :
So inodes are tight but overall space is also 60% used.
Notable, partially overlapping, parts of storage used:
360M app-root
257M app-deployments/2015-01-25_18-20-02.081
212M app-root/runtime/repo
212M app-deployments/2015-01-25_18-20-02.081/repo
170M app-deployments/2015-01-25_18-20-02.081/repo/MathJax
169M app-root/runtime/repo/MathJax
104M app-root/logs
45M app-root/runtime/dependencies/.npm
45M app-deployments/2015-01-25_18-20-02.081/dependencies/.npm
AFAICT app-root vs app-deployments/2015... are copies, not symlinks nor hardlinks.
app-root/logs contains miniscule haproxy logs and 10x10M nodejs.log* consiting of stdout/err from my server.js.
For unclear reason, my logs consist predominantly of
GET /: (abridged sort | uniq -c | sort -n):[Interesting. That's a LOT of hits for /, especially for a server not linked to almost anywhere on the net. Though the domain has existed for a long time.]
After running
rhc app-tidy mathdown, went from 95.6% to 95.4% inodes :-(cben commentedon Feb 15, 2015
inodes issue split to #73
cben commentedon Feb 15, 2015
RHcloud* Bronze plan lets me auto-scale to 16 gears. First 3 small gears are free but 13 more would cost me pretty $190/month.
=> I'm setting auto-scaling to max 5 gears. It unlikely I'll need more than 1 anyway.
*I've been saying "Openshift" interchageably till now but to be precise Openshift is the software (open source) and RHcloud is the hosted instance run by RedHat.
cben commentedon Feb 15, 2015
Fixed inodes quota blocker, ready to flip mathdown.net to RHcloud! :-)
Will document & commit some things first.
cben commentedon Feb 17, 2015
For the record: Heroku has a handy "[Production Check]" button on top right.
=> It basically says:
Split off a long README on deployment to Heroku/RHcloud (#57), and ad…
cben commentedon Feb 17, 2015
Load test (using Blitz addon via Heroku) shows that Heroku can sustain more load:
Heroku sustains up to 250 hits/sec with latency <30ms and zero errors: https://www.blitz.io/report/3f3d541ec0f1d2df0e0299fa0e580e4c
(though in other runs I've seen a few errors — closer to start actually)
while RHcloud gives goes into high latency and up to 50% errors around 170 users:
https://www.blitz.io/report/3f3d541ec0f1d2df0e0299fa0ed6aa18
For some reason the sharable links from Blitz only include subset of metrics, so here is a manually built plot from their .csv:
https://plot.ly/~cben/30
I don't expect to see that many users soon (though IIUC that's 250 HTTP requests, not 250 full page loads) but what bothers me:
(And while it has 4 cores, it's not like 25% = one core — trying
while(1) {}went to 96% cpu.)=> OK, let's force scaling by configuring 2–5 gears?
=>> Yes, sustained 250 "users"! Latency up to 270ms but zero errors :-)
I'm going to keep 2–5 as it allows fast failover if one crashes. And because why not...
cben commentedon Feb 18, 2015
Correction: not zero errors: TCP Connection timeout 3
And with 1 gear, there were: TCP Connection timeout 495
Heroku also had: TCP Connection timeout 1.
So now I know what kind of errors they were.
Actually when rare they're not really errors, just high latency arbitrarily going over Blitz's threshold.
[With 1 gear when there were hundreds of them, the latency would have been so high that for users it really felt as never load.]
Retries RHcloud (2 gears) with 5sec timeout => 5,978 hits with 0 errors & 0 timeouts :-)
https://www.blitz.io/report/9a569554c9bfc4668288240c3554550d
But now the latencies are not so fun: Fastest: 15 ms Slowest: 1,059 ms Average: 238 ms
Too bad Blitz doesn't show the full latency histogram.
The good news is that this exlains why I'm was not seeing any kind of errors in Haproxy status screen (which I'm not sure how to read but all "denied", "errors" etc. were 0).
cben commentedon Feb 18, 2015
Pushed new version (minor server.coffee change) to Heroku and RHcloud.
Heroku took 44s: 6sec git(?), 10s checkout submodules, 5s ?, 10s build, 6s compress slug, 5s launch.
RHcloud took 06m17s :-( :
It's not very clear why it's so slow, it just is... (e.g. what happened between 0:08–1:01?)
There are details but maybe out of date at http://www.openshift.org/documentation/openshift-pep-006-deploy.html#git-deployments-current-openshift-workflow
I suspect copying ~300M takes a lot of the time. Oh, well. I hope the future docker-based Openshift will be faster.
What's most striking is that it first stops the app, then builds, then starts — that's ~6min of downtime?!
But in reality I have 2 gears, and I see app responding during that — Haproxy shows that first local gear goes down (the one on same node with haproxy), only after it's up again 2nd gear is restarted (much faster).
There is a
hot_deployoption which doesn't stop server. Alas, it doesn't restart it at all, which is not what I want.Ah, there is option to move build outside the 1st gear by offloading it to a Jenkins cartridge. Don't think I want it.
cben commentedon Feb 18, 2015
OK, I just flipped mathdown.net to RHcloud!
cben commentedon Feb 20, 2015
Closing this issue as essentially done.
Opened new issues with
deploy.rhcloud,deploy.herokutags for needed improvements.Update README with switch RHcloud with HTTPS.
cben commentedon Aug 3, 2015
Heroku has new pricing
https://blog.heroku.com/archives/2015/6/15/dynos-pricing-ga
TLDR: free apps must sleep 6h per day (sleep after 30min inactivity);
new $7/mo "hobby" 1 dyno never sleeps;
more dynos from $25/mo.
I've switched to the new free and reactivated the uptimerobot once-in-2h ping to see how it works.
(I'd be migrated to this anyway in August)
I'm likely to go $7/mo.