-
Notifications
You must be signed in to change notification settings - Fork 0
add x86 version #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Dashlorde
wants to merge
14
commits into
master
Choose a base branch
from
x86
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
598f592
add x86 version
Dashlorde 68728db
add readme
Dashlorde 3b3c998
update readme
Dashlorde 1057a8b
update readme
Dashlorde dc2c5f4
delete environment
Dashlorde 55108e2
update remote host name
Dashlorde d4e1282
change to use environment variable
Dashlorde bc8aad1
delete useless server.js
Dashlorde 3a09592
update readme
Dashlorde cd78183
Reduce hardcoded stuffs
Dashlorde d56e129
fix revert conflit
Dashlorde 8259c37
update to use default port 5984
Dashlorde bcc923f
update filename
Dashlorde d5654e7
Delete readme.md
Dashlorde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Bell | ||
|
|
||
| Dockerize bell app | ||
|
|
||
| ## Components | ||
|
|
||
| * Bell. It is bell app container build with node.js. | ||
| * Couchdb. It is the database container which is initiated with `db-init`. | ||
|
|
||
| ## How to use | ||
|
|
||
| ### Build manually | ||
|
|
||
| 1. Download the source code. Get into the version folder (x86 or arm for example). | ||
| 2. Run command to build the image | ||
|
|
||
| ```shell | ||
| /bin/bash build.sh | ||
| ``` | ||
| 3. Run command to start containers | ||
|
|
||
| ```shell | ||
| docker-compose up -d | ||
| ``` | ||
| 4. Run command to stop containers | ||
|
|
||
| ```shell | ||
| docker-compose stop | ||
| ``` | ||
| 5. Run command to delete the environment | ||
|
|
||
| ```shell | ||
| docker-compose down | ||
| ``` | ||
| 6. See if docker containers running | ||
|
|
||
| ```shell | ||
| docker ps | ||
| ``` | ||
|
|
||
| 7. View container log | ||
|
|
||
| ```shell | ||
| docker logs {{container_id}} | ||
| ``` | ||
|
|
||
| ### Use the pre-build image | ||
|
|
||
| 1. Run command to start bell | ||
| ```shell | ||
| docker-compose -f docker-compose-ready.yml up -d | ||
| ``` | ||
|
|
||
| 2. Run command to stop bell | ||
| ```shell | ||
| docker-compose -f docker-compose-ready.yml stop | ||
| ``` | ||
|
|
||
| 3. Delete environment | ||
| ```shell | ||
| docker-compose -f docker-compose-ready.yml down | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| FROM node:6.11-alpine | ||
|
|
||
| LABEL MAINTAINER "Dashlorde <zhouyunlu0216@gmail.com>" | ||
| LABEL MAINTAINER "Abdurrachman Mappuji <mappuji@ole.org>" | ||
| LABEL MAINTAINER "dogi <stefan@unterhauser.name>" | ||
|
|
||
| ENV version '0.13.21' | ||
|
|
||
| RUN mkdir -p /app/server/src && \ | ||
| apk add --update openssl && npm install express | ||
|
|
||
| WORKDIR /app/server/src | ||
|
|
||
| COPY server.js ./ | ||
| COPY package.json ./ | ||
|
|
||
| RUN chmod +x ./server.js && npm install | ||
|
|
||
| EXPOSE 80 | ||
|
|
||
| CMD ["npm","start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| docker build . -t bell:latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| FROM node:6.11-alpine | ||
|
|
||
| LABEL MAINTAINER "Dashlorde <zhouyunlu0216@gmail.com>" | ||
| LABEL MAINTAINER "Abdurrachman Mappuji <mappuji@ole.org>" | ||
| LABEL MAINTAINER "dogi <stefan@unterhauser.name>" | ||
|
|
||
| ENV version '0.13.21' | ||
|
|
||
| RUN mkdir -p /app/server/src && \ | ||
| apk add --update openssl && npm install express | ||
|
|
||
| WORKDIR /app/server/src | ||
|
|
||
| COPY server.js ./ | ||
| COPY package.json ./ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not use original |
||
|
|
||
| RUN chmod +x ./server.js && npm install | ||
|
|
||
| EXPOSE 80 | ||
|
|
||
| CMD ["npm","start"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "bell-apps", | ||
| "description": "A collection of Apps for the BeLL", | ||
| "version": "0.0.1", | ||
| "author": "R.J. Steinert <rj@rjsteinert.com>", | ||
| "main": "server.js", | ||
| "scripts": { | ||
| "start": "node server.js" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "http://github.com/open-learning-exchange/bell-apps.git" | ||
| }, | ||
| "dependencies": { | ||
| "couchapp": ">= 0.10.0", | ||
| "underscore": ">= 1.5.2", | ||
| "nano": "6.0.1", | ||
| "commander": "2.5.0", | ||
| "request": ">= 2.27.0", | ||
| "co": ">= 4.6.0", | ||
| "cookie": ">= 0.3.1", | ||
| "express": "^4.16.1" | ||
|
|
||
| }, | ||
| "engines": { "node": ">= 6.9.2" } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| var express = require('express') | ||
| var PortJack = express() | ||
| var path = require("path"); | ||
| var HOST = process.env.HOST; | ||
|
|
||
| PortJack.get(/^(.+)$/, function(req, res) { | ||
|
|
||
| res.setHeader('Location', 'http://' + HOST + ':5984/apps/_design/bell/MyApp/index.html') | ||
|
|
||
| res.statusCode = 302 | ||
| res.end() | ||
| }) | ||
|
|
||
| PortJack.listen(80) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| docker build bell/. -t treehouses/bell:latest | ||
| docker build db-init/. -t treehouses/bell:db-init-latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| docker build bell/. -t bell:latest | ||
| docker build db-init/. -t bell:db-init-latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| FROM node:6.11-alpine | ||
|
|
||
| LABEL MAINTAINER "Dashlorde <zhouyunlu0216@gmail.com>" | ||
| LABEL MAINTAINER "Abdurrachman Mappuji <mappuji@ole.org>" | ||
| LABEL MAINTAINER "dogi <stefan@unterhauser.name>" | ||
|
|
||
| ENV version '0.13.21' | ||
|
|
||
| RUN apk update && \ | ||
| apk add --no-cache bash curl git jq openssl && \ | ||
| mkdir bell && wget -O bell/BeLL-Apps-${version}.tar.gz \ | ||
| https://github.com/open-learning-exchange/BeLL-Apps/archive/0.13.21.tar.gz && \ | ||
| cd bell && tar xvf BeLL-Apps-${version}.tar.gz && \ | ||
| mkdir -p /app && mv BeLL-Apps-${version}/* /app && \ | ||
| chmod +x /app/node_modules/.bin/couchapp && \ | ||
| #CORS DOWNLOAD | ||
| npm install -g add-cors-to-couchdb | ||
|
|
||
| COPY docker-entrypoint.sh /root/docker-entrypoint.sh | ||
| COPY couchdb-setup.sh /root/couchdb-setup.sh | ||
|
|
||
| RUN chmod +x /root/couchdb-setup.sh | ||
|
|
||
| CMD sh /root/docker-entrypoint.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| docker build . -t bell:db-init-latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Options are -u for username -w for passWord and -p for port number | ||
| while getopts "u:w:p:h:" option; do | ||
| case $option in | ||
| u) COUCHUSER=${OPTARG};; | ||
| w) COUCHPASSWORD=${OPTARG};; | ||
| p) PORT=${OPTARG};; | ||
| h) HOST=${OPTARG};; | ||
| esac | ||
| done | ||
|
|
||
| if [ -z "$HOST" ] | ||
| then | ||
| HOST=127.0.0.1 | ||
| fi | ||
|
|
||
| # Default port for CouchDB accessed from host machine is 2200 | ||
| PORT=${PORT:-5984} | ||
| if [ -z "$COUCHUSER" ] | ||
| then | ||
| COUCHURL=http://$HOST:$PORT | ||
| else | ||
| COUCHURL=http://$COUCHUSER:$COUCHPASSWORD@$HOST:$PORT | ||
| fi | ||
|
|
||
| curl -X PUT $COUCHURL/_users | ||
| curl -X PUT $COUCHURL/_replicator | ||
| curl -X PUT $COUCHURL/_global_changes | ||
|
|
||
| for database in /app/databases/*.js; do | ||
| curl -X PUT $COUCHURL/${database:15:-3} | ||
| case ${database:15:-3} in | ||
| "communities" | "languages" | "configurations" ) ;; | ||
| * ) /app/node_modules/.bin/couchapp push $database $COUCHURL/${database:15:-3} ;; | ||
| esac | ||
| done | ||
|
|
||
| ## add bare minimal required data to couchdb for launching bell-apps smoothly | ||
| for filename in /app/init_docs/languages/*.txt; do | ||
| curl -d @$filename -H "Content-Type: application/json" -X POST $COUCHURL/languages; | ||
| done | ||
| curl -d @app/init_docs/ConfigurationsDoc-Community.txt -H "Content-Type: application/json" -X POST $COUCHURL/configurations | ||
| curl -d @app/init_docs/admin.txt -H "Content-Type: application/json" -X POST $COUCHURL/members |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
|
|
||
| #WAIT_TIME | ||
| while ! curl -X GET couchdb:5984/_all_dbs ; do | ||
| sleep 1 | ||
| done | ||
|
|
||
|
|
||
| #CORS SETUP | ||
| add-cors-to-couchdb http://couchdb:5984 | ||
|
|
||
| #MIGRATOR | ||
| /root/couchdb-setup.sh -p 5984 -h couchdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| FROM node:6.11-alpine | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| LABEL MAINTAINER "Dashlorde <zhouyunlu0216@gmail.com>" | ||
| LABEL MAINTAINER "Abdurrachman Mappuji <mappuji@ole.org>" | ||
| LABEL MAINTAINER "dogi <stefan@unterhauser.name>" | ||
|
|
||
| ENV version '0.13.21' | ||
|
|
||
| RUN apk update && \ | ||
| apk add --no-cache bash curl git jq openssl && \ | ||
| mkdir bell && wget -O bell/BeLL-Apps-${version}.tar.gz \ | ||
| https://github.com/open-learning-exchange/BeLL-Apps/archive/0.13.21.tar.gz && \ | ||
| cd bell && tar xvf BeLL-Apps-${version}.tar.gz && \ | ||
| mkdir -p /app && mv BeLL-Apps-${version}/* /app && \ | ||
| chmod +x /app/node_modules/.bin/couchapp && \ | ||
| #CORS DOWNLOAD | ||
| npm install -g add-cors-to-couchdb | ||
|
|
||
| COPY docker-entrypoint.sh /root/docker-entrypoint.sh | ||
| COPY couchdb-setup.sh /root/couchdb-setup.sh | ||
|
|
||
| RUN chmod +x /root/couchdb-setup.sh | ||
|
|
||
| CMD sh /root/docker-entrypoint.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| couchdb: | ||
| expose: | ||
| - 5984 | ||
| ports: | ||
| - "5984:5984" | ||
| image: klaemo/couchdb | ||
| db-init: | ||
| image: treehouses/bell:db-init-latest | ||
| depends_on: | ||
| - couchdb | ||
| bell: | ||
| image: treehouses/bell:latest | ||
| ports: | ||
| - "80:80" | ||
| environment: | ||
| - HOST=127.0.0.1 | ||
| depends_on: | ||
| - couchdb | ||
| version: "2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| couchdb: | ||
| expose: | ||
| - 5984 | ||
| image: klaemo/couchdb | ||
| ports: | ||
| - "5984:5984" | ||
| db-init: | ||
| image: bell:db-init-latest | ||
| depends_on: | ||
| - couchdb | ||
| bell: | ||
| image: bell:latest | ||
| ports: | ||
| - "80:80" | ||
| environment: | ||
| - HOST=127.0.0.1 | ||
| depends_on: | ||
| - couchdb | ||
| version: "2" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dockerfileshould beDockerfile