Commit b43c6070 authored by Killian Kemps's avatar Killian Kemps

Merge branch 'docker' into 'master'

Docker

"Contenarize" Qowala with Docker and Docker Compose to install it easier in production.

Removes possibility to use Vagrant

This Merge Request is not perfect. However it's been merged to master and will be later moved to `v1` branch as it is now all legacy.

See merge request !7
parents a28a6799 ca9d89e2
node_modules/ node_modules/
config/twitter.json qowala_app/config/twitter.json
.vagrant .vagrant
*.sublime-project *.sublime-project
*.sublime-workspace *.sublime-workspace
......
...@@ -2,5 +2,7 @@ language: node_js ...@@ -2,5 +2,7 @@ language: node_js
node_js: node_js:
- "0.10" - "0.10"
before_script: before_script:
- cd qowala_app
- npm install
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start - sh -e /etc/init.d/xvfb start
FROM node:0.12
MAINTAINER Killian Kemps
RUN mkdir /var/app
COPY qowala_app/package.json var/app/package.json
RUN cd /var/app && npm install
RUN npm install -g forever
COPY qowala_app var/app/
WORKDIR /var/app
EXPOSE 8080
ADD docker/service-start.sh /
CMD ["/service-start.sh"]
qowala_app:
build: .
ports:
- "8080:8080"
links:
- mongo
mongo:
image: mongo
ports:
- "27017:27017"
#!/bin/bash
# WORKDIR
cd /var/app
# Start NodeJS server
forever -l forever.log -ao stdout.log -e stderr.log server.js
FROM node:0.12
MAINTAINER Killian Kemps
#RUN apt-get update
#RUN apt-get install -y curl
# Install nvm for NodeJS
#RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
#RUN export NVM_DIR="/root/.nvm"
#RUN [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
#
## Install NodeJS v0.12 via nvm
#RUN nvm install v0.12
#RUN nvm use v0.12
RUN mkdir /var/app
# Fails here as it only copies the Dockerfile
COPY * /var/app/
WORKDIR /var/app/
RUN cd /var/app/ && ls
RUN npm install
RUN npm install -g forever
EXPOSE 8080
CMD ["forever", "-l forever.log -ao stdout.log -e stderr.log start server.js"]
FROM ubuntu
MAINTAINER Killian Kemps
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 || true
RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
RUN apt-get update && apt-get install -y \
build-essential \
mongodb-org
EXPOSE 27017
CMD ["mongod"]
...@@ -18,17 +18,18 @@ var dbconfig = require('./config/db'); ...@@ -18,17 +18,18 @@ var dbconfig = require('./config/db');
var mongoUri = process.env.MONGODB_ADDON_URI || var mongoUri = process.env.MONGODB_ADDON_URI ||
process.env.MONGOLAB_URI || process.env.MONGOLAB_URI ||
process.env.MONGOHQ_URL || process.env.MONGOHQ_URL ||
'mongodb://' + process.env.MONGO_PORT_27017_TCP_ADDR + '/qowala:' + process.env.MONGO_PORT_27017_TCP_PORT ||
dbconfig.url; dbconfig.url;
mongoose.connect(mongoUri, function(err, dbconfig) { mongoose.connect(mongoUri, function(err, dbconfig) {
if(!err) { if(!err) {
console.log("We are connected to mongoDB"); console.log("We are connected to mongoDB");
} }
else {
console.log('Error while connecting to mongo: ', err);
}
}); // Connect to our mongoDB database (commented out after you enter in your own credentials) }); // Connect to our mongoDB database (commented out after you enter in your own credentials)
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
// Setup sessions // Setup sessions
app.use(session({ app.use(session({
secret: 'this1337is42a1337super42secret1337keyword' secret: 'this1337is42a1337super42secret1337keyword'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment