1
0

further update files

This commit is contained in:
wodka 2019-07-15 15:02:21 +02:00
parent f7b1dd05e9
commit e175abb9e3
20 changed files with 48 additions and 7544 deletions

View File

@ -2,76 +2,47 @@ FROM node:10-alpine
MAINTAINER OhMyForm <admin@ohmyform.com>
# Install some needed packages
RUN apk add --no-cache \
git \
&& rm -rf /tmp/*
## TODO: Crush these consecutive RUN's into a single run if possible.
# Install NPM Global Libraries
RUN npm install --quiet -g grunt bower pm2 && npm cache clean --force
RUN apk add --no-cache git \
&& rm -rf /tmp/* \
&& npm install --quiet -g grunt bower pm2 \
&& npm cache clean --force \
&& mkdir -p /opt/app/public/lib
WORKDIR /opt/app
RUN mkdir -p /opt/app/public/lib
## TODO: Optimize layers here as copy layers can be easily reduced if saner COPY usage is achieved.
# Add bower.json
COPY bower.json /opt/app/bower.json
COPY .bowerrc /opt/app/.bowerrc
COPY ./process.yml /opt/app/process.yml
COPY ./app /opt/app/app
COPY ./public /opt/app/public
COPY ./config /opt/app/config
COPY ./gruntfile.js /opt/app/gruntfile.js
COPY ./server.js /opt/app/server.js
COPY ./scripts/create_admin.js /opt/app/scripts/create_admin.js
## TODO: Find a method that's better than this for passing ENV's if possible.
# Set default ENV
ENV NODE_ENV=development
ENV SECRET_KEY=ChangeMeChangeMe
#ENV MONGODB_URI=mongodb://mongo/ohmyform
#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=ohmyform@localhost
ENV MAILER_PASSWORD=
ENV MAILER_FROM=ohmyform@localhost
ENV MAILER_SERVICE_PROVIDER=
ENV MAILER_SMTP_HOST=
ENV MAILER_SMTP_PORT=
ENV MAILER_SMTP_SECURE=
ENV NODE_ENV=development \
SECRET_KEY=ChangeMeChangeMe \
PORT=5000 \
BASE_URL=localhost \
SOCKET_PORT=20523 \
SIGNUP_DISABLED=FALSE \
SUBDOMAINS_DISABLED=FALSE \
ENABLE_CLUSTER_MODE=FALSE \
MAILER_EMAIL_ID=ohmyform@localhost \
MAILER_PASSWORD="" \
MAILER_FROM=ohmyform@localhost \
MAILER_SERVICE_PROVIDER="" \
MAILER_SMTP_HOST="" \
MAILER_SMTP_PORT="" \
MAILER_SMTP_SECURE="" \
CREATE_ADMIN=FALSE \
ADMIN_EMAIL=admin@ohmyform.com \
ADMIN_USERNAME=root \
ADMIN_PASSWORD=root \
APP_NAME=OhMyForm \
APP_KEYWORDS="" \
APP_DESC="" \
COVERALLS_REPO_TOKEN="" \
GOOGLE_ANALYTICS_ID="" \
RAVEN_DSN=""
ENV CREATE_ADMIN=FALSE
ENV ADMIN_EMAIL=admin@ohmyform.com
ENV ADMIN_USERNAME=root
ENV ADMIN_PASSWORD=root
COPY package.json bower.json .bowerrc app public config gruntfile.js server.js scripts ./
ENV APP_NAME=OhMyForm
ENV APP_KEYWORDS=
ENV APP_DESC=
RUN npm install --only=production --quiet \
&& bower install --allow-root -f \
&& grunt build
# optional ENV settings
ENV COVERALLS_REPO_TOKEN=
ENV GOOGLE_ANALYTICS_ID=
ENV RAVEN_DSN=
## TODO: Determine if it's necessary to have this COPY be it's own separate operation.
# 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
# when the local package.json file changes.
# Add npm package.json
COPY ./package.json /opt/app/package.json
RUN npm install --only=production --quiet
RUN bower install --allow-root
RUN grunt build
## TODO: Determine if it would be possible to do a multi stage container where the prebuilt app is copied with nothing else from the build step.
## TODO: Make this configure things on startup in a sane way or don't if the operator passes any configuration files perhaps via a start.sh.
# Run OhMyForm server
CMD ["node", "server.js"]

View File

@ -1,32 +0,0 @@
# Build:
# docker build -t tellform-prod -f ./Dockerfile-production .
#
# Run:
# docker run -it tellform-prod
FROM node:7
MAINTAINER David Baldwynn <team@tellform.com>
# Install NPM Global Libraries
RUN npm install --quiet -g grunt bower && npm cache clean
WORKDIR /code
# Add bower.json
COPY package.json /code/package.json
COPY bower.json /code/bower.json
COPY .bowerrc /code/.bowerrc
COPY ./process.yml /code/process.yml
COPY ./app /code/app
COPY ./public /code/public
COPY ./config /code/config
COPY ./gruntfile.js /code/gruntfile.js
COPY ./server.js /code/server.js
COPY ./scripts/create_admin.js /code/scripts/create_admin.js
RUN npm install --quiet
RUN bower install --config.interactive=false --allow-root
# Run TellForm server
CMD ["node", "server.js"]

25
Vagrantfile vendored
View File

@ -1,25 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
## TODO: Reconsider this as we don't have this configuration anymore.
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 3000, host: 4567
config.vm.provision "docker" do |d|
d.run "mongo",
args: "-p 27017:27017 -d --name some-mongo"
d.run "redis",
args: "-p 6379:6379 -d --name some-redis"
d.run "tellform/development",
args: "-p 3000:3000 --link some-redis:redis-db --link some-mongo:db"
end
end

View File

@ -1,37 +0,0 @@
{
"name": "TellForm",
"description": "Beautiful, opensource web forms",
"repository": "https://github.com/tellform/tellform",
"logo": "https://tellform.com/public/img/tellform_logo_black.png",
"keywords": ["node", "express", "static", "mean"],
"addons": ["mongolab", "sendgrid", "heroku-redis"],
"env": {
"SUBDOMAINS_DISABLED": {
"description": "Disable support for running subdomains. (This should be true if you are not using your own custom domain.",
"value": "TRUE"
},
"ENABLE_CLUSTER_MODE": {
"description": "ENABLE support for running in cluster mode on pm2",
"value": "FALSE"
},
"NODE_ENV": {
"description": "Choose whether to run app in development or production mode",
"value": "production"
},
"BASE_URL": {
"description": "The url of your heroku app."
},
"SOCKET_URL": {
"description": "Where you websockets will connect to (i.e. your heroku app url)"
},
"MAILER_SERVICE_PROVIDER": {
"description": "Which mail service/API you will be using (i.e. SparkPost, Mandrill, etc)",
"value": "SendGrid"
}
},
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-nodejs#v111"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,10 +0,0 @@
#!/bin/bash
## TODO: Reconsider this as I think that it's no longer relevant.
line=$(head -n 1 /etc/hosts)
echo "$line tellform.dev $(hostname)" >> /etc/hosts
# Restart sendmail
service sendmail restart
# Run Server
npm start

View File

@ -1,41 +0,0 @@
<!-- TODO: Consider modernizing this and moving it to https://ohmyform.com's documentation -->
# wildcard DNS in localhost development
- install [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html)
```
$ brew install dnsmasq
...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
```
- edit `/usr/local/etc/dnsmasq.conf`
```
address=/dev/127.0.0.1
```
- start **dnsmasq**
```
$ sudo brew services start dnsmasq
```
- any time we change `dnsmasq.conf` we have to re-start **dnsmasq**:
```
$ sudo launchctl stop homebrew.mxcl.dnsmasq
$ sudo launchctl start homebrew.mxcl.dnsmasq
```
- For OS X to _resolve_ requests from `*.dev` to **localhost** we need to add a _resolver_:
```
$ sudo mkdir /etc/resolver
$ sudo touch /etc/resolver/dev
```
- edit `/etc/resolver/dev`
```
nameserver 127.0.0.1
```
- re-start the computer to enable the _resolver_
===
**REFERENCES**
- [Using Dnsmasq for local development on OS X - Passing Curiosity](https://passingcuriosity.com/2013/dnsmasq-dev-osx/)
- [Using Dnsmasq Configure Wildcard DNS Record on Mac | Ri Xu Online](https://xuri.me/2014/12/13/using-dnsmasq-configure-wildcard-dns-record-on-mac.html)
- [unix - In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain? - Server Fault](http://serverfault.com/questions/118378/in-my-etc-hosts-file-on-linux-osx-how-do-i-do-a-wildcard-subdomain)
- [hostname - Wildcard in /etc/hosts file - Unix & Linux Stack Exchange](http://unix.stackexchange.com/questions/3352/wildcard-in-etc-hosts-file)
- [Mac OS Lion - Wildcard subdomain virtual host - Stack Overflow](http://stackoverflow.com/questions/9562059/mac-os-lion-wildcard-subdomain-virtual-host)
- [How to put wildcard entry into /etc/hosts? - Stack Overflow](http://stackoverflow.com/questions/20446930/how-to-put-wildcard-entry-into-etc-hosts)

View File

@ -1,44 +0,0 @@
version: "3"
services:
tellform:
build:
context: .
dockerfile: ./Dockerfile-dev
volumes:
- .:/code
ports:
- "5000"
- 587:587
env_file:
- .env
links:
- mongo
- redis
depends_on:
- mongo
- redis
redis:
restart: always
image: redis
volumes:
- "$ROOT/redis:/data"
ports:
- "6379:6379"
web:
image: tellform/nginx:stable
restart: always
ports:
- "80:80"
- "443:443"
- "20523:20523"
env_file:
- .env
volumes:
- "$ROOT/certs:/certs"
mongo:
restart: always
image: mongo
volumes:
- "$ROOT/mongo:/data"
ports:
- "27107:27107"

View File

@ -8,9 +8,12 @@ services:
volumes:
- "./data/mongo:/data"
tellform:
image: ohmyform/ohmyform
build: .
volumes:
- ".:/opt/app"
environment:
CREATE_ADMIN: "TRUE"
SOCKET_URL: 'localhost:5000'
SOCKET_PORT: "5000"
SOCKET_PORT_EXTERN_VISIBLE: "TRUE"
MONGODB_URI: mongodb://mongo/tellform
@ -30,3 +33,13 @@ services:
image: mailhog/mailhog
ports:
- "5050:8025"
mongoexpress:
image: mongo-express
environment:
ME_CONFIG_MONGODB_SERVER: mongo
ports:
- "5051:8081"
links:
- mongo
depends_on:
- mongo

View File

@ -1,35 +0,0 @@
{
"apps" : [{
"name" : "tellform",
"script" : "server.js",
"instances": "max",
"exec_mode": "cluster",
"max_memory_restart" : "200M"
}],
"deploy" : {
"stage": {
"user": "polydaic",
"host": "159.203.42.158",
"ref": "origin/stage",
"repo": "git@github.com:tellform/tellform.git",
"path": "/opt/deploy",
"post-deploy": "npm install && pm2 startOrGracefulReload ecosystem.json --env production",
"env": {
"NODE_ENV": "production",
"BASE_URL": "stage.tellform.com"
}
},
"prod": {
"user": "polydaic",
"host": "159.203.33.182",
"ref": "origin/master",
"repo": "git@github.com:tellform/tellform.git",
"path": "/opt/deploy",
"post-deploy": "npm install && pm2 startOrGracefulReload ecosystem.json --env production",
"env": {
"NODE_ENV": "production",
"BASE_URL": "admin.tellform.com"
}
}
}
}

View File

@ -1,5 +0,0 @@
apps:
- script : 'server.js'
name : 'TellForm'
exec_mode: 'cluster'
instances: 4

Binary file not shown.

View File

@ -1,20 +0,0 @@
#!/bin/bash
if [ ! -e server.js ]
then
echo "Error: could not find main application server.js file"
echo "You should run the generate-ssl-certs.sh script from the main MEAN application root directory"
echo "i.e: bash scripts/generate-ssl-certs.sh"
exit -1
fi
echo "Generating self-signed certificates..."
mkdir -p ./config/sslcerts
openssl genrsa -out ./config/sslcerts/key.pem -aes256 1024
openssl rsa -in ./config/sslcerts/key.pem -out ./config/sslcerts/newkey.pem
rm ./config/sslcerts/key.pem
mv ./config/sslcerts/newkey.pem ./config/sslcerts/key.pem
openssl req -new -key ./config/sslcerts/key.pem -out ./config/sslcerts/csr.pem
openssl x509 -req -days 9999 -in ./config/sslcerts/csr.pem -signkey ./config/sslcerts/key.pem -out ./config/sslcerts/cert.pem
rm ./config/sslcerts/csr.pem
chmod 600 ./config/sslcerts/key.pem ./config/sslcerts/cert.pem

View File

@ -1,24 +0,0 @@
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
fi
# make sure we're at the root of git repo
if [ ! -d .git ]; then
echo "Error: must run this script from the root of a git repository"
exit 1
fi
# remove all paths passed as arguments from the history of the repo
files=$@
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune

View File

@ -1,4 +0,0 @@
#!/bin/bash
## TODO: Reconsider this as I have no idea what the point of it is.
node server.js
#pm2 start process.yml

7203
yarn.lock

File diff suppressed because it is too large Load Diff