Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Add Dockerfile and Makefile #56

Merged
merged 2 commits into from May 11, 2016
Merged

Add Dockerfile and Makefile #56

merged 2 commits into from May 11, 2016

Conversation

jgmize
Copy link
Contributor

@jgmize jgmize commented May 3, 2016

@jwhitlock
Copy link
Contributor

What do you want out of a review?

@jgmize
Copy link
Contributor Author

jgmize commented May 3, 2016

What do you want out of a review?

  1. Install docker
  2. make build
  3. make test
  4. make run
  5. verify that running kumascript service works as expected on port 9080.

@jwhitlock
Copy link
Contributor

Failed on make build: https://pastebin.mozilla.org/8870483

@jgmize
Copy link
Contributor Author

jgmize commented May 10, 2016

@jwhitlock that was just a network glitch: Failed to fetch http://httpredir.debian.org/debian/pool/main/n/node-read/node-read_1.0.5-1_all.deb Error reading from server. Remote end closed connection -- would you mind trying again?

@jwhitlock
Copy link
Contributor

Next ran passed. Moving on...

@jwhitlock
Copy link
Contributor

Failed on make test: https://pastebin.mozilla.org/8870495

@jgmize
Copy link
Contributor Author

jgmize commented May 10, 2016

thanks @jwhitlock, it was passing locally b/c I ran npm install while the app dir was mounted against my local machine, which installed them into node_modules on the host machine, which were then being used during make test. I've added c146eae so that it will use /node_modules within the container instead.

@jwhitlock
Copy link
Contributor

make test works now.

In the development environment, you'd make a request like this to render the content of https://developer-local.allizom.org/en-US/docs/Mozilla:

curl  http://localhost:9080/docs/en-US/Mozilla

When running this against Docker, I get:

curl: (7) Failed to connect to localhost port 9080: Connection refused

There is no logging output from the make run command.

The other production difference is that we create a kumascript_settings_local.json file, with something like:

{
    "log": {
        "console": true,
        "file": {
            "filename": "/home/vagrant/logs/kumascript.log",
            "maxsize": 500000
        }
    },
    "server": {
        "port": 9080,
        "numWorkers": 4,
        "workerTimeout": 10000,
        "memcache": {
            "server": {"127.0.0.1:11211": 1},
            "options": { }
        },
        "macro_timeout": 60000,
        "document_url_template": "https://localhost/en-US/docs/{path}?raw=1",
        "template_url_template": "https://localhost/en-US/docs/en-US/Template:{name}?raw=1",
        "template_class": "EJSTemplate",
        "autorequire": {
            "mdn": "MDN:Common",
            "Date": "DekiScript:Date",
            "Page": "DekiScript:Page",
            "String": "DekiScript:String",
            "Uri": "DekiScript:Uri",
            "Web": "DekiScript:Web",
            "Wiki": "DekiScript:Wiki"
        }
    }
}

I don't know if any effort has been made to instead get config variables from the environment. The code suggests port 9000 is the default in one place, and 9080 in another place.

@jgmize
Copy link
Contributor Author

jgmize commented May 11, 2016

curl http://localhost:9080/docs/en-US/Mozilla
When running this against Docker, I get:
curl: (7) Failed to connect to localhost port 9080: Connection refused

The localhost port mapping works in linux and in the latest docker for mac beta (I recommend signing up for it if you haven't already), but assuming you're using the current release of docker-toolbox then you'll need to connect to the virtualbox vm's ip on that port, which can be obtained with docker-machine ip.

Locally for me, make run followed by curl http://localhost:9080/docs/en-US/Mozilla in another shell gives me:

<p>The articles below include content about downloading and building Mozilla code. In addition, you'll find helpful articles about how the code works, how to build add-ons for Mozilla applications and the like.</p>

<p><p><strong>There are no subpages at this time.</strong></p></p>

I don't know if any effort has been made to instead get config variables from the environment.

I haven't made any in this PR, but we can and should follow up on that after this PR lands.

@jwhitlock
Copy link
Contributor

docker-machine ip default gives 192.168.99.100, and curl http://192.168.99.100/docs/en-US/Mozilla gives the same response. It appears to be talking to production, since giving a recent page path curl http://192.168.99.100:9080/docs/id/Web/CSS gives the content of a page created today.

+r, merge when ready.

@jgmize jgmize merged commit 0253be4 into mdn:master May 11, 2016
@jgmize jgmize deleted the docker branch May 11, 2016 03:52
@groovecoder
Copy link
Contributor

FWIW, I had a commit on the heroku branch that made kumascript listen to process.env.port.

Our nconf module should be able to use environment variables for config values, but it seems like I had trouble getting the env vars to work?

jwhitlock added a commit to mdn/kuma that referenced this pull request Aug 29, 2016
Update the kumascript submodule to include the Docker PRs:

mdn/kumascript#56
mdn/kumascript#57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants