Compare commits

..

No commits in common. "master" and "stable2.1" have entirely different histories.

15 changed files with 102 additions and 496 deletions

View file

@ -1,124 +0,0 @@
# TellForm Configuration File
###################################
# Common configuration variables
###################################
# Set this to the path where Mailu data and configuration is stored
# Mac users: Change to a Docker accessible folder
ROOT=/opt/tellform_data
# Set to what environment you will be running TellForm in (production or development)
NODE_ENV=development
# Set to a randomly generated 16 bytes string
SECRET_KEY=ChangeMeChangeMe
# URI of Mongo database that TellForm will connect to
#DO NOT CHANGE
MONGODB_URI=mongodb://mongo/tellform
# URL Redis server that TellForm will connect to
#DO NOT CHANGE
REDIS_URL=redis://redis:6379
# Port that the TellForm Node app will listen on
PORT=5000
# Domain that TellForm's admin panel will be hosted at
BASE_URL=tellform.dev
# Port that SocketIO server (for analytics) will listen on
SOCKET_PORT=20523
#Choose what kind of TLS you want.
#Can be either 'cert' (supply your certificates in ./cert/), 'notls' (no https at all) or 'letsencrypt' that autoconfigures your instance with letsencrypt
TLS_FLAVOR=notls
###################################
# Optional features
###################################
# Set this to enable coveralls.io support
COVERALLS_REPO_TOKEN=
# Disable signups for your TellForm instance
SIGNUP_DISABLED=FALSE
# Disable per-user custom subdomains
SUBDOMAINS_DISABLED=FALSE
# Url that subdomains will be hosted at (has to have domain name as ADMIN_URL)
# Only used when SUBDOMAINS_DISABLED=FALSE
SUBDOMAIN_URL=*.tellform.dev
# Enable running TellForm in pm2's 'cluster' mode
ENABLE_CLUSTER_MODE=FALSE
###################################
# Mail settings
# IMPORTANT: These settings need to be set
# to be set in order for your instance to work
###################################
# Set this to set the username credential of your SMTP service
MAILER_EMAIL_ID=
# Set this to set the password credential of your SMTP service
MAILER_PASSWORD=
# Set this to set the email address that all email should be sent from for signup/verification emails
MAILER_FROM=
# Set this to any services from https://nodemailer.com/smtp/well-known/ to use a 'well-known' email provider
MAILER_SERVICE_PROVIDER=
# Set these if you are not using a 'MAILER_SERVICE_PROVIDER' and want to specify your SMTP server's address and port
MAILER_SMTP_HOST=
MAILER_SMTP_PORT=
# Set this if you are using a custom SMTP server that supports SSL
MAILER_SMTP_SECURE
###################################
# Automatic Admin Creation Settings
###################################
# Set this to "TRUE" if you wish to automatically create an admin user on startup
CREATE_ADMIN=FALSE
# Set this to set the email used by your default admin account
ADMIN_EMAIL=admin@admin.com
# Set this to set the username of your default admin acconut
ADMIN_USERNAME=root
# Set this to set the password of your default admin account
ADMIN_PASSWORD=root
###################################
# Advanced settings
###################################
# Set this to server your websockets server on a seperate URL
SOCKETS_URL=
# Set this to change the port that TellForm will listen on
PORT=5000
# Set this to your Google Analytics ID to enable tracking with GA
GOOGLE_ANALYTICS_ID=
# Set this to your Sentry.io DSN code to enable front-end JS error tracking with Sentry.io
RAVEN_DSN
# Set this to set the 'name' meta property in the HTML <head>
APP_NAME=
# Set this to set the 'keywords' meta property in the HTML <head>
APP_KEYWORDS=
# Set this to set the 'description' meta property in the HTML head
APP_DESC=

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
data/
dist
.vagrant
npm-debug.*

View file

@ -4,16 +4,33 @@
# Run:
# docker run -it tellform-prod
FROM node:10-alpine
MAINTAINER Arielle Baldwynn <team@tellform.com>
FROM phusion/baseimage:0.9.19
MAINTAINER David Baldwynn <team@tellform.com>
# Install some needed packages
RUN apk add --no-cache \
git \
&& rm -rf /tmp/*
# Install Utilities
RUN apt-get update -q \
&& apt-get install -yqq \
curl \
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
RUN npm install --quiet -g grunt bower pm2 && npm cache clean --force
RUN npm install --quiet -g grunt bower pm2 && npm cache clean
WORKDIR /opt/tellform
RUN mkdir -p /opt/tellform/public/lib
@ -30,39 +47,6 @@ COPY ./gruntfile.js /opt/tellform/gruntfile.js
COPY ./server.js /opt/tellform/server.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
# and utilities docker container cache to not needing to rebuild
# and install node_modules/ everytime we build the docker, but only
@ -70,8 +54,6 @@ ENV RAVEN_DSN=
# Add npm package.json
COPY ./package.json /opt/tellform/package.json
RUN npm install --only=production --quiet
RUN bower install --allow-root
RUN grunt build
# Run TellForm server
CMD ["node", "server.js"]

108
README.md
View file

@ -1,34 +1,18 @@
TellForm 2.1.0
========
DEPRECATION WARNING UNTIL FURTHER NOTICE.
There are many oudated and vulnerable dependencies within this project and I recommend that you use this code repository for internal testing and development only.
There were too many impassable hurdles to really continue forward at the pace that I was hoping with TellForm @leopere~ If you want to follow my progress on an alternative in the mean time check out https://OhMyForm.com or our Discord server. We managed to get the base Docker image fixed before forking the code so you can give this a try however not much has changed at the moment.
<!--
[![Code Shelter](https://www.codeshelter.co/static/badges/badge-flat.svg)](https://www.codeshelter.co/)
[![Build Status](https://travis-ci.org/tellform/tellform.svg?branch=master)](https://travis-ci.org/tellform/tellform)
![Project Status](https://img.shields.io/badge/status-2.1.0-green.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3491e86eb7194308b8fc80711d736ede)](https://www.codacy.com/app/david-baldwin/tellform?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=tellform/tellform&amp;utm_campaign=Badge_Grade)
-->
[![Gitter](https://badges.gitter.im/tellform/Lobby.svg)](https://gitter.im/tellform/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
To Join the fork's community please follow this Discord button here.
> An *opensource alternative to TypeForm* that can create [stunning mobile-ready forms](https://tellform.com/examples) , surveys and questionnaires.
![Discord](https://img.shields.io/discord/595773457862492190.svg?label=Discord%20Chat)
## Readme and Issues
The README.md is still effectively in tact however it's all been commented out so that it's no longer visible on the main github repository page. You may visit it by navigating through the repositories files themselves.
No new or old issues will be tended to so the Issues Board has been closed. We don't recommend using this repositories codebase as its no longer maintained and is only intended for reference code. If you wish to use the fork which should remain backwards compatible feel free to explore [https://ohmyform.com](https://ohmyform.com/) or its GitHub repository at [https://github.com/ohmyform/ohmyform/](https://github.com/ohmyform/ohmyform/) where the code base is started from TellForm we are planning on keeping it reverse compatible however the code is Sublicensed AGPL and is going to have a stable release prepared for the public hopefully but September 12th 2019. It should be a drop in replacement for TellForm which should expand on the vision of TellForm but hopefully bring it all up to date.
<!--
> An *opensource alternative to TypeForm* that can create [stunning mobile-ready forms](https://tellform.com/examples) , surveys and questionnaires.-->
<!--
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/tellform/tellform/tree/master)
-->
<!--
## Table of Contents
- [Features](#features)
- [How to Contribute](#how-to-contribute)
- [Quickstart](#quickstart)
@ -40,8 +24,11 @@ No new or old issues will be tended to so the Issues Board has been closed. We
- [Backers](#backers)
- [Contributors](#contributors)
- [Mentions on the Web](#mentions-on-the-web)
## Features
### Currently following features are implemented:
- Multi-Language Support
- 11 possible question types
- Editable start and end pages
@ -51,6 +38,7 @@ No new or old issues will be tended to so the Issues Board has been closed. We
- Embeddable Forms
- Forms as a Service API
- Deployable with Heroku and DockerHub
### On the Roadmap for v3.0.0
- Implement encryption for all form data
- Add Typeform API integration
@ -59,27 +47,37 @@ No new or old issues will be tended to so the Issues Board has been closed. We
- Add Stripe/Payment Form field
- Add Custom Background and Dropdown Field Images
- Add File Upload Form Field
## How to Contribute
Please checkout our CONTRIBUTING.md on ways to contribute to TellForm.
All contributors are eligible to get a free [TellForm Sticker](https://www.stickermule.com/marketplace/15987-tellform-round-sticker). All you have to do is submit a PR, get it accepted, email your address to team [at] tellform.com and we'll send you a sticker that you can proudly put on your laptop.
## Quickstart
Before you start, make sure you have
1. [Redis](https://redis.io/) installed and running at 127.0.0.1:6379
2. [MongoDB](https://www.mongodb.com/) installed and running at 127.0.0.1:27017 (OR specify the host and port in config/env/all)
Also make sure to install [DNS Masq](http://www.thekelleys.org.uk/dnsmasq/doc.html) or equivalent if running it locally on your computer (look at dns_masq_setup_osx for instructions on OSX)
Install dependencies first.
```bash
$ npm install
$ bower install
```
Setup environment.
```bash
$ grunt build
```
Create your user account
```bash
$ node ./scripts/setup.js
```
OR create your .env file
```
GOOGLE_ANALYTICS_ID=yourGAID
@ -87,67 +85,85 @@ PRERENDER_TOKEN=yourPrerender.ioToken
COVERALLS_REPO_TOKEN=yourCoveralls.ioToken
BASE_URL=localhost
DSN_KEY=yourPrivateRavenKey
# Mail config
MAILER_EMAIL_ID=user@domain.com
MAILER_PASSWORD=some-pass
MAILER_FROM=user@domain.com
# Use this for one of Nodemailer's pre-configured service providers
MAILER_SERVICE_PROVIDER=SendGrid
# Use these for a custom service provider
# Note: MAILER_SMTP_HOST will override MAILER_SERVICE_PROVIDER
MAILER_SMTP_HOST=smtp.domain.com
MAILER_SMTP_PORT=465
MAILER_SMTP_SECURE=TRUE
```
Side note: ___Currently we are using Raven and Sentry [https://www.getsentry.com](https://www.getsentry.com) for error logging. To use it you must provide a valid private DSN key in your .env file and a public DSN key in app/views/layout.index.html___
#### To run the development version:
Set ```NODE_ENV=development``` in .env file
```$ grunt```
#### To run the production version:
Set ```NODE_ENV=production``` in .env file
```$ grunt```
Your application should run on port 3000 or the port you specified in your .env file, so in your browser just go to [http://localhost:3000](http://localhost:3000)
## Deploying with Docker
To deploy with docker, first install docker [here](https://docs.docker.com/engine/installation/).
Then run follow these steps:
### Step 1: Clone the repo
`$ git clone https://github.com/tellform/docker_files.git`
### Step 2: Setup TellForm Configuration
Create your .env file by copying the .env.dist file included in the repo and changing it to suit your deployment.
Important: You need to fill out all of the ENV variables in the "Mail Settings" section or your TellForm instance won't work.
If you want to have https, make sure to change 'TLS_FLAVOR'
### Step 3: Start your TellForm instance
`docker-compose up -d`
TellForm should now be accessible on http://localhost
Then see this page [here](https://tellform.com/install_docker) for commands on how to deploy your own local TellForm instance.
## Testing Your Application
You can run the full test suite included with TellForm with the test task:
```
$ grunt test
```
This will run both the server-side tests (located in the app/tests/ directory) and the client-side tests (located in the public/modules/*/tests/).
To execute only the server tests, run the test:server task:
```
$ grunt test:server
```
And to run only the client tests, run the test:client task:
```
$ grunt test:client
```
Currently the live example uses heroku github deployments. The Docker file is out of date and does not work. If someone wishes to get it working feel free to submit a pull request.
To calculate your total test coverage with Istanbul, run the coverage task
```bash
$ grunt coverage
```
To calculate your server-side test coverage with Istanbul, run the coverage task
```bash
$ grunt coverage:server
```
To calculate your client-side test coverage with Istanbul, run the coverage task
```bash
$ grunt coverage:client
```
## Configuration
TellForm's configuration is done with environment variables. To set an option for TellForm, open/create your .env file and set add `ENV_VAR=somevalue` to set the ENV_VAR variable to the value `somevalue`.
| Property | Valid Values | Default Value | Description | Required? |
|-------------------------|--------------------------------------------------------|----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| NODE_ENV | "development", "production", "test" or "secure" | development | Set which version of the app you want to run (either secure/SSL, dev, prod or test) | No |
@ -176,24 +192,42 @@ TellForm's configuration is done with environment variables. To set an option fo
| APP_KEYWORDS | A comma-seperated list of phrases/words | typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs | Sets the value of the <meta> description attribute. | No |
| RAVEN_DSN | A valid Sentry.io DSN | N/A | Set this to your Sentry.io Public DSN to enable remote logging | No |
| GOOGLE_ANALYTICS_ID | A valid Google Analytics ID | N/A | Set this to your GA id to enable GA tracking on your TellForm instance | No |
## Where to get help
[Gitter Chat](https://gitter.im/tellform/Lobby)
[Official Twitter](https://twitter.com/tellform_real)
-->
## Sponsors
Further Sponsorships are no longer accepted.
<!--
Does your company use TellForm? Help keep the project bug-free and feature rich by [sponsoring the project](https://opencollective.com/tellform#sponsor).
<a href="https://countable.ca" style="padding: 30px 0">
<img src="https://countable.ca/logo.cb446ab0.svg" height="30px">
</a> -->
<a href="https://m.do.co/c/a86fd8843e09" style="padding: 30px 0">
<img src="/docs/readme_logos/digitalOcean.png" height="30px">
</a>
<a href="https://getsentry.com/" style="padding: 30px 0">
<img src="/docs/readme_logos/sentryIO.png" height="30px">
</a>
<a href="https://statuspage.io/" style="padding: 30px 0">
<img src="/docs/readme_logos/statusPageIO.png" height="30px">
</a>
<br><br>
<a href="https://www.stickermule.com/unlock?ref_id=0939360701" style="padding: 30px 0">
<img src="/docs/readme_logos/stickerMule.png" height="30px">
</a>
<a href="https://sparkpost.com/" style="padding: 30px 0">
<img src="/docs/readme_logos/sparkPost.png" height="30px">
</a>
<a href="https://therooststand.com/" style="padding: 30px 0">
<img src="/docs/readme_logos/theRoostStand.png" height="30px">
</a>
## Backers
Love our work and community? <!--[Become a backer](https://opencollective.com/tellform).-->
Love our work and community? [Become a backer](https://opencollective.com/tellform).
<a href="https://opencollective.com/elliot" target="_blank">
<img src="https://opencollective.com/proxy/images/?src=https%3A%2F%2Fd1ts43dypk8bqh.cloudfront.net%2Fv1%2Favatars%2F6fd61b2c-62b6-438a-9168-bab7ef1489b8" height= "64">

View file

@ -37,7 +37,7 @@
"angular-translate": "~2.11.0",
"ng-translate": "*",
"deep-diff": "^0.3.4",
"jsep": "0.3.1",
"jsep": "^0.3.1",
"ngclipboard": "^1.1.1",
"mobile-detect": "^1.3.3",
"socket.io-client": "^1.7.2",

View file

@ -9,14 +9,7 @@ var config = require('./config'),
// Define the Socket.io configuration method
module.exports = function (app, db) {
var server = http.createServer(app);
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'] });
}
var io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
if(config.enableClusterMode){
var redis = require('socket.io-redis');

View file

@ -1,55 +0,0 @@
version: "3"
services:
redis:
restart: always
image: redis
networks:
- back-tier
mongo:
restart: always
image: mongo
volumes:
- ".data/mongo:/data"
networks:
- back-tier
tellform:
build:
context: .
environment:
CREATE_ADMIN: "TRUE"
MONGODB_URI: mongodb://mongo/tellform
REDIS_URL: redis://redis
# volumes:
# - .:/opt/tellform
links:
- mongo
- redis
ports:
- "5000:5000"
depends_on:
- mongo
- redis
networks:
- back-tier
web:
# image: tellform/nginx:stable
build:
context: ./nginx
# image: nginx:1.13
restart: always
ports:
- "80:80"
- "443:443"
- "20523:20523"
environment:
NODE_ENV: development
#volumes:
# - "$ROOT/certs:/certs"
# - ./nginx/conf.d:/etc/nginx/conf.d
networks:
- back-tier
networks:
back-tier:
driver: bridge

View file

@ -1,19 +0,0 @@
FROM alpine:edge
RUN apk add --no-cache nginx certbot openssl python py-jinja2
COPY *.py /
COPY conf /conf
RUN chmod +x /start.py
RUN chmod +x /letsencrypt.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

View file

@ -1,116 +0,0 @@
# Basic configuration
user nginx;
worker_processes 1;
error_log /dev/stderr info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
# Standard HTTP configuration with slight hardening
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
server_tokens off;
#Websockets Server
server {
{% if NODE_ENV == "development" %}
listen {{SOCKET_PORT}};
{% else %}
listen 80;
listen [::]:80;
server_name {{ SOCKETS_URL }};
# Only enable HTTPS if TLS is enabled with no error
{% if TLS and not TLS_ERROR %}
listen 443 ssl;
listen [::]:443 ssl;
include /etc/nginx/tls.conf;
add_header Strict-Transport-Security max-age=15768000;
if ($scheme = http) {
return 301 https://$host$request_uri;
}
{% endif %}
{% endif %}
location / {
proxy_pass http://tellform:20523;
proxy_read_timeout 90;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
{% if TLS and not TLS_ERROR %}
proxy_set_header X-Forwarded-Proto https;
{% endif %}
}
{% if TLS_FLAVOR == 'letsencrypt' %}
location ^~ /.well-known/acme-challenge/ {
proxy_pass http://127.0.0.1:8008;
}
{% endif %}
}
server {
#Add server_name for per-user subdomains
{% if SUBDOMAINS_DISABLED == "FALSE" %}
server_name {{BASE_URL}} {{SUBDOMAIN_URL}};
{% else %}
server_name {{BASE_URL}};
{% endif %}
listen 80;
listen [::]:80;
# Only enable HTTPS if TLS is enabled with no error
{% if TLS and not TLS_ERROR %}
listen 443 ssl;
listen [::]:443 ssl;
include /etc/nginx/tls.conf;
add_header Strict-Transport-Security max-age=15768000;
if ($scheme = http) {
return 301 https://$host$request_uri;
}
{% endif %}
root /usr/share/nginx/html;
index index.html index.htm;
location / {
proxy_pass http://tellform:5000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
{% if TLS and not TLS_ERROR %}
proxy_set_header X-Forwarded-Proto https;
{% endif %}
}
{% if TLS_FLAVOR == 'letsencrypt' %}
location ^~ /.well-known/acme-challenge/ {
proxy_pass http://127.0.0.1:8008;
}
{% endif %}
}
}

View file

@ -1,7 +0,0 @@
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384';
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_certificate {{ TLS[0] }};
ssl_certificate_key {{ TLS[1] }};
ssl_dhparam /certs/dhparam.pem;

View file

@ -1,26 +0,0 @@
#!/usr/bin/python
import jinja2
import os
convert = lambda src, dst, args: open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
args = os.environ.copy()
# TLS configuration
args["TLS"] = {
"cert": ("/certs/cert.pem", "/certs/key.pem"),
"letsencrypt": ("/certs/letsencrypt/live/mailu/fullchain.pem",
"/certs/letsencrypt/live/mailu/privkey.pem"),
"notls": None
}[args["TLS_FLAVOR"]]
if args["TLS"] and not all(os.path.exists(file_path) for file_path in args["TLS"]):
print("Missing cert or key file, disabling TLS")
args["TLS_ERROR"] = "yes"
# Build final configuration paths
convert("/conf/tls.conf", "/etc/nginx/tls.conf", args)
convert("/conf/nginx.conf", "/etc/nginx/nginx.conf", args)
os.system("nginx -s reload")

View file

@ -1,29 +0,0 @@
#!/usr/bin/python
import os
import time
import subprocess
command = [
"certbot",
"-n", "--agree-tos", # non-interactive
"-d", os.environ["HOSTNAMES"],
"-m", "{}@{}".format(os.environ["POSTMASTER"], os.environ["DOMAIN"]),
"certonly", "--standalone",
"--server", "https://acme-v02.api.letsencrypt.org/directory",
"--cert-name", "tellform",
"--preferred-challenges", "http", "--http-01-port", "8008",
"--keep-until-expiring",
"--rsa-key-size", "4096",
"--config-dir", "/certs/letsencrypt",
"--post-hook", "./config.py"
]
# Wait for nginx to start
time.sleep(5)
# Run certbot every hour
while True:
subprocess.call(command)
time.sleep(3600)

View file

@ -1,25 +0,0 @@
#!/usr/bin/python
import os
import subprocess
#Set default port
if not os.environ["PORT"]:
os.environ["PORT"] = "5000"
#Set default sockets port
if not os.environ["SOCKET_PORT"]:
os.environ["SOCKET_PORT"] = "20523"
# Actual startup script
if not os.path.exists("/certs/dhparam.pem") and os.environ["TLS_FLAVOR"] != "notls":
os.system("openssl dhparam -out /certs/dhparam.pem 2048")
if os.environ["TLS_FLAVOR"] == "letsencrypt":
subprocess.Popen(["/letsencrypt.py"])
elif os.environ["TLS_FLAVOR"] == "cert":
if not os.path.exists("/certs/cert.pem"):
os.system("openssl req -newkey rsa:2048 -x509 -keyout /certs/key.pem -out /certs/cert.pem -days 365 -nodes -subj '/C=NA/ST=None/L=None/O=None/CN=" + os.environ["BASE_URL"] + "'")
subprocess.call(["/config.py"])
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])

View file

@ -5,14 +5,14 @@ var config = require('../config/config'),
exports.run = function(app, db, cb) {
var User = mongoose.model('User');
var email = config.admin.email || 'admin@admin.com';
var email = 'admin@admin.com' || config.admin.email;
var newUser = new User({
firstName: 'Admin',
lastName: 'Account',
email: email,
username: config.admin.username || 'root',
password: config.admin.password || 'root',
username: 'root' || config.admin.username,
password: 'root' || config.admin.password,
provider: 'local',
roles: ['admin', 'user']
});

View file

@ -40,8 +40,7 @@ const smtpTransport = nodemailer.createTransport(config.mailer.options);
smtpTransport.verify(function(error, success) {
if (error) {
console.error(chalk.red('Your mail configuration is incorrect: ' + error));
// verify but to abort!
// process.exit(-1);
process.exit(-1);
}
});
@ -49,7 +48,7 @@ smtpTransport.verify(function(error, success) {
var app = require('./config/express')(db);
//Create admin account
if (process.env.CREATE_ADMIN === 'TRUE') {
if (process.env.CREATE_ADMIN_ACCOUNT === 'TRUE') {
var create_admin = require('./scripts/create_admin');
create_admin.run(app, db, function(err){