Sheng Li (gmachine1729) wrote,
Sheng Li

I finally used Docker and Amazon Elastic Beanstalk (to deploy Disqus comment search service)

Originally published at 狗和留美者不得入内. You can comment here or there.

For those of you who don’t want to read this, I have my Disqus comment search deployed now, at

From now on, I’ll give an outline of my experience deploying my Disqus comment search web app.


I had deployed the Disqus comment search web service I developed on Heroku, with the endpoint being What I didn’t expect was to end up blocked on account verification (now I’m pretty sure it’s almost certainly not my problem, since a similar procedure has worked on others), especially given that Heroku is pretty large and established, now a Salesforce company.

So that led me to try AWS. I made an account (it’s kind of a shame that I never cared enough about software engineering to have already made one long ago) and with some looking up info online plus trial and error I got it deployed on Amazon Elastic Beanstalk. As for details, I developed this in Scala using Scalatra and when testing locally, it was powered by Jetty web server, which I ran in sbt. For Heroku all I had to do, after incorporating a


(you can easily find the source online) was a

git push heroku master

and that did the trick. It detected sbt, did the build, made the .jar and .war files and deployed it to that endpoint.

Amazon Elastic Beanstalk + Docker

On Amazon Elastic Beanstalk, I first tried (too wishfully) deploying it directly as Apache Tomcat, and expectedly I got 404. So it occurred to me to try Docker, which is probably the more systematic way of going about it nowadays. I first did a Tomcat within Docker.

For that, the code was

# Pull base image
From tomcat:8-jre8

# Maintainer
MAINTAINER "gmachine1729 <">

# Copy to images tomcat path
ADD [url where I stored my locally built .war file] /usr/local/tomcat/webapps/

# Some copies of resources used by this webapp
[omitted Docker config code]

# for a Python subprocess within my Scala
RUN apt-get -y update
RUN apt-get -y install python


CMD ["", "run"]

I remember it also asked for

at one point. And I found online and copied and modified to something like

  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "disqus-comment-search-tomcat2:latest"
  "Ports": [
      "ContainerPort": "8888"

In the above,


is name of my locally built Docker image.

And it worked, excepting a css glitch that resolved itself after a few refreshes.

Later on I decided that probably I should use Jetty, the environment that I’m testing in. The Dockerfile is

FROM jetty:9.3-jre8

USER root

# copies of resources
[code omitted]

# told me to use ROOT.war to deploy to / context
ADD [url where I uploaded my locally built war file] /var/lib/jetty/webapps/ROOT.war

RUN apt-get -y update
RUN apt-get -y install python


In command line, using


, part of the whole suite of AWS CLI tools,

eb create

did the trick. This was after I did

eb init

in which I made sure to pick Docker in one of the selections asking for the type of deployment.

I also realized that, because this worked, the stuff in

still there is superfluous. All I remember was it had at one point given me an error in the likes of “No” So you might need the file, but contents inside it might not matter for something as simple as this.

Domain name with GoDaddy and then Amazon Route53

I had purchased a domain name through GoDaddy (the domain name provider probably best known that I chose without really considering other choices) before trying Amazon and Docker. Originally, my plan was to connect to Heroku, but after Heroku kept blocking me, I full-heartedly decided to switch to AWS. And after the deployment on AWS was resolved, searching for info to add CNAME or whatever to connect GoDaddy domain to the AWS endpoint only gave me a rather incoherent clutter of info. But through it I learned of Route 53, Amazon’s domain name provider, which is much easier to integrate with AWS EB.

So I bought another domain name through Route 53 ($12 per year with privacy protection cheaper than GoDaddy). The procedure to route it to my AWS EB endpoint was very simple. I made an Alias record in the Hosted Zone corresponding to the domain I bought through Route 53 that was automatically added for me following instructions in

2019-05-04 下午2.45.16

Within 60 seconds, brought me to my Disqus comment search web service.

2019-05-04 下午2.52.12

I hope this information can be helpful to people who do similar stuff in the future. Feedback welcome!

Tags: disqus search, 软件

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened