Merge pull request #344 from wodka/simplify-docker
improve docker images, fix jsep and initial build
This commit is contained in:
commit
210c7544e7
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
data/
|
||||||
dist
|
dist
|
||||||
.vagrant
|
.vagrant
|
||||||
npm-debug.*
|
npm-debug.*
|
||||||
|
64
Dockerfile
64
Dockerfile
@ -4,33 +4,16 @@
|
|||||||
# Run:
|
# Run:
|
||||||
# docker run -it tellform-prod
|
# docker run -it tellform-prod
|
||||||
|
|
||||||
FROM phusion/baseimage:0.9.19
|
FROM node:10-alpine
|
||||||
MAINTAINER Arielle Baldwynn <team@tellform.com>
|
MAINTAINER Arielle Baldwynn <team@tellform.com>
|
||||||
|
|
||||||
# Install Utilities
|
# Install some needed packages
|
||||||
RUN apt-get update -q \
|
RUN apk add --no-cache \
|
||||||
&& apt-get install -yqq \
|
git \
|
||||||
curl \
|
&& rm -rf /tmp/*
|
||||||
ant \
|
|
||||||
git \
|
|
||||||
gcc \
|
|
||||||
make \
|
|
||||||
build-essential \
|
|
||||||
libkrb5-dev \
|
|
||||||
python \
|
|
||||||
sudo \
|
|
||||||
apt-utils \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
# Install nodejs
|
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
|
||||||
RUN sudo apt-get install -yq nodejs \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
# Install NPM Global Libraries
|
# Install NPM Global Libraries
|
||||||
RUN npm install --quiet -g grunt bower pm2 && npm cache clean
|
RUN npm install --quiet -g grunt bower pm2 && npm cache clean --force
|
||||||
|
|
||||||
WORKDIR /opt/tellform
|
WORKDIR /opt/tellform
|
||||||
RUN mkdir -p /opt/tellform/public/lib
|
RUN mkdir -p /opt/tellform/public/lib
|
||||||
@ -47,6 +30,39 @@ COPY ./gruntfile.js /opt/tellform/gruntfile.js
|
|||||||
COPY ./server.js /opt/tellform/server.js
|
COPY ./server.js /opt/tellform/server.js
|
||||||
COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
|
COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
|
||||||
|
|
||||||
|
# Set default ENV
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
ENV SECRET_KEY=ChangeMeChangeMe
|
||||||
|
#ENV MONGODB_URI=mongodb://mongo/tellform
|
||||||
|
#ENV REDIS_URL=redis://redis:6379
|
||||||
|
ENV PORT=5000
|
||||||
|
ENV BASE_URL=localhost
|
||||||
|
ENV SOCKET_PORT=20523
|
||||||
|
ENV SIGNUP_DISABLED=FALSE
|
||||||
|
ENV SUBDOMAINS_DISABLED=FALSE
|
||||||
|
ENV ENABLE_CLUSTER_MODE=FALSE
|
||||||
|
ENV MAILER_EMAIL_ID=tellform@localhost
|
||||||
|
ENV MAILER_PASSWORD=
|
||||||
|
ENV MAILER_FROM=tellform@localhost
|
||||||
|
ENV MAILER_SERVICE_PROVIDER=
|
||||||
|
ENV MAILER_SMTP_HOST=
|
||||||
|
ENV MAILER_SMTP_PORT=
|
||||||
|
ENV MAILER_SMTP_SECURE=
|
||||||
|
|
||||||
|
ENV CREATE_ADMIN=FALSE
|
||||||
|
ENV ADMIN_EMAIL=admin@tellform.com
|
||||||
|
ENV ADMIN_USERNAME=root
|
||||||
|
ENV ADMIN_PASSWORD=root
|
||||||
|
|
||||||
|
ENV APP_NAME=Tellform
|
||||||
|
ENV APP_KEYWORDS=
|
||||||
|
ENV APP_DESC=
|
||||||
|
|
||||||
|
# optional ENV settings
|
||||||
|
ENV COVERALLS_REPO_TOKEN=
|
||||||
|
ENV GOOGLE_ANALYTICS_ID=
|
||||||
|
ENV RAVEN_DSN=
|
||||||
|
|
||||||
# Copies the local package.json file to the container
|
# Copies the local package.json file to the container
|
||||||
# and utilities docker container cache to not needing to rebuild
|
# and utilities docker container cache to not needing to rebuild
|
||||||
# and install node_modules/ everytime we build the docker, but only
|
# and install node_modules/ everytime we build the docker, but only
|
||||||
@ -54,6 +70,8 @@ COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
|
|||||||
# Add npm package.json
|
# Add npm package.json
|
||||||
COPY ./package.json /opt/tellform/package.json
|
COPY ./package.json /opt/tellform/package.json
|
||||||
RUN npm install --only=production --quiet
|
RUN npm install --only=production --quiet
|
||||||
|
RUN bower install --allow-root
|
||||||
|
RUN grunt build
|
||||||
|
|
||||||
# Run TellForm server
|
# Run TellForm server
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
"angular-translate": "~2.11.0",
|
"angular-translate": "~2.11.0",
|
||||||
"ng-translate": "*",
|
"ng-translate": "*",
|
||||||
"deep-diff": "^0.3.4",
|
"deep-diff": "^0.3.4",
|
||||||
"jsep": "^0.3.1",
|
"jsep": "0.3.1",
|
||||||
"ngclipboard": "^1.1.1",
|
"ngclipboard": "^1.1.1",
|
||||||
"mobile-detect": "^1.3.3",
|
"mobile-detect": "^1.3.3",
|
||||||
"socket.io-client": "^1.7.2",
|
"socket.io-client": "^1.7.2",
|
||||||
|
@ -9,7 +9,14 @@ var config = require('./config'),
|
|||||||
// Define the Socket.io configuration method
|
// Define the Socket.io configuration method
|
||||||
module.exports = function (app, db) {
|
module.exports = function (app, db) {
|
||||||
var server = http.createServer(app);
|
var server = http.createServer(app);
|
||||||
var io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
|
var io;
|
||||||
|
|
||||||
|
// make it possible to only expose one domain
|
||||||
|
if (process.env.SOCKET_PORT != process.env.PORT) {
|
||||||
|
io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
|
||||||
|
} else {
|
||||||
|
io = socketio(server, { transports: ['websocket', 'polling'] });
|
||||||
|
}
|
||||||
|
|
||||||
if(config.enableClusterMode){
|
if(config.enableClusterMode){
|
||||||
var redis = require('socket.io-redis');
|
var redis = require('socket.io-redis');
|
||||||
|
@ -3,31 +3,29 @@ services:
|
|||||||
redis:
|
redis:
|
||||||
restart: always
|
restart: always
|
||||||
image: redis
|
image: redis
|
||||||
volumes:
|
|
||||||
- "${PWD}/.env:/opt/tellform/.env"
|
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
mongo:
|
mongo:
|
||||||
restart: always
|
restart: always
|
||||||
image: mongo
|
image: mongo
|
||||||
volumes:
|
volumes:
|
||||||
- "$ROOT/mongo:/data"
|
- ".data/mongo:/data"
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
tellform:
|
tellform:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
env_file:
|
environment:
|
||||||
- .env
|
CREATE_ADMIN: "TRUE"
|
||||||
volumes:
|
MONGODB_URI: mongodb://mongo/tellform
|
||||||
# - "${PWD}/.env:/opt/tellform/.env"
|
REDIS_URL: redis://redis
|
||||||
- .:/opt/tellform
|
# volumes:
|
||||||
|
# - .:/opt/tellform
|
||||||
links:
|
links:
|
||||||
- mongo
|
- mongo
|
||||||
- redis
|
- redis
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
# - "20523:20523"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongo
|
- mongo
|
||||||
- redis
|
- redis
|
||||||
@ -43,10 +41,10 @@ services:
|
|||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
- "20523:20523"
|
- "20523:20523"
|
||||||
env_file:
|
environment:
|
||||||
- .env
|
NODE_ENV: development
|
||||||
volumes:
|
#volumes:
|
||||||
- "$ROOT/certs:/certs"
|
# - "$ROOT/certs:/certs"
|
||||||
# - ./nginx/conf.d:/etc/nginx/conf.d
|
# - ./nginx/conf.d:/etc/nginx/conf.d
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
|
@ -8,4 +8,12 @@ RUN chmod +x /start.py
|
|||||||
RUN chmod +x /letsencrypt.py
|
RUN chmod +x /letsencrypt.py
|
||||||
RUN chmod +x /config.py
|
RUN chmod +x /config.py
|
||||||
|
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
ENV PORT=5000
|
||||||
|
ENV SOCKET_PORT=20523
|
||||||
|
ENV TLS_FLAVOR=notls
|
||||||
|
ENV BASE_URL=localhost
|
||||||
|
ENV SUBDOMAIN_URL=*.localhost
|
||||||
|
ENV SOCKETS_URL=ws.localhost
|
||||||
|
|
||||||
CMD /start.py
|
CMD /start.py
|
||||||
|
@ -5,14 +5,14 @@ var config = require('../config/config'),
|
|||||||
exports.run = function(app, db, cb) {
|
exports.run = function(app, db, cb) {
|
||||||
|
|
||||||
var User = mongoose.model('User');
|
var User = mongoose.model('User');
|
||||||
var email = 'admin@admin.com' || config.admin.email;
|
var email = config.admin.email || 'admin@admin.com';
|
||||||
|
|
||||||
var newUser = new User({
|
var newUser = new User({
|
||||||
firstName: 'Admin',
|
firstName: 'Admin',
|
||||||
lastName: 'Account',
|
lastName: 'Account',
|
||||||
email: email,
|
email: email,
|
||||||
username: 'root' || config.admin.username,
|
username: config.admin.username || 'root',
|
||||||
password: 'root' || config.admin.password,
|
password: config.admin.password || 'root',
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
roles: ['admin', 'user']
|
roles: ['admin', 'user']
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,8 @@ const smtpTransport = nodemailer.createTransport(config.mailer.options);
|
|||||||
smtpTransport.verify(function(error, success) {
|
smtpTransport.verify(function(error, success) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(chalk.red('Your mail configuration is incorrect: ' + error));
|
console.error(chalk.red('Your mail configuration is incorrect: ' + error));
|
||||||
process.exit(-1);
|
// verify but to abort!
|
||||||
|
// process.exit(-1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ smtpTransport.verify(function(error, success) {
|
|||||||
var app = require('./config/express')(db);
|
var app = require('./config/express')(db);
|
||||||
|
|
||||||
//Create admin account
|
//Create admin account
|
||||||
if (process.env.CREATE_ADMIN_ACCOUNT === 'TRUE') {
|
if (process.env.CREATE_ADMIN === 'TRUE') {
|
||||||
var create_admin = require('./scripts/create_admin');
|
var create_admin = require('./scripts/create_admin');
|
||||||
|
|
||||||
create_admin.run(app, db, function(err){
|
create_admin.run(app, db, function(err){
|
||||||
|
Loading…
Reference in New Issue
Block a user