Compare commits
1 Commits
scripts
...
teststuff3
Author | SHA1 | Date | |
---|---|---|---|
74103cc401 |
17
.c9/.nakignore
Normal file
17
.c9/.nakignore
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
*~backup-*
|
||||||
|
.c9revisions
|
||||||
|
.c9
|
||||||
|
.git
|
||||||
|
.svn
|
||||||
|
.DS_Store
|
||||||
|
.bzr
|
||||||
|
.cdv
|
||||||
|
~.dep
|
||||||
|
~.dot
|
||||||
|
~.nib
|
||||||
|
~.plst
|
||||||
|
.hg
|
||||||
|
.pc
|
||||||
|
*.min.js
|
||||||
|
.nakignore
|
||||||
|
/dev
|
1
.c9/metadata/tab1
Normal file
1
.c9/metadata/tab1
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"filter":false,"title":"Immediate (Javascript (browser))","tooltip":"Immediate (Javascript (browser))","undoManager":{"mark":0,"position":0,"stack":[[{"start":{"row":8,"column":40},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":53},{"start":{"row":9,"column":0},"end":{"row":10,"column":0},"action":"insert","lines":["",""]}]]},"immediate":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":0},"end":{"row":8,"column":21},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0,"type":"jsbrowser","history":["\"refs/heads/template\".match(/\\/master$/)","\"refs/heads/master\".match(/\\/master$/)","s.match(/\\/master$/)","s = \"refs/heads/master\""],"pos":-1},"timestamp":1452973618356,"hash":"722c479a340a3da2396735615b87d31f3373e145"}
|
1
.c9/metadata/tab8
Normal file
1
.c9/metadata/tab8
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"filter":false,"title":"Terminal","undoManager":{"mark":-1,"position":-1,"stack":[]},"terminal":{"id":"devel_232","cwd":"","width":1328,"height":243,"scrollTop":393},"timestamp":1452978225696,"hash":"67452301efcdab8998badcfe10325476c3d2e1f0"}
|
1
.c9/metadata/workspace/bin/www
Normal file
1
.c9/metadata/workspace/bin/www
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"filter":false,"title":"www","tooltip":"/bin/www","undoManager":{"mark":2,"position":2,"stack":[[{"start":{"row":14,"column":47},"end":{"row":14,"column":50},"action":"remove","lines":["000"],"id":2},{"start":{"row":14,"column":47},"end":{"row":14,"column":48},"action":"insert","lines":["1"]}],[{"start":{"row":14,"column":48},"end":{"row":14,"column":49},"action":"insert","lines":["8"],"id":3}],[{"start":{"row":14,"column":49},"end":{"row":14,"column":50},"action":"insert","lines":["0"],"id":4}]]},"ace":{"folds":[],"scrolltop":120,"scrollleft":0,"selection":{"start":{"row":14,"column":50},"end":{"row":14,"column":50},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1452973670538,"hash":"d84e8bd402fee361726b1d5ab6cdf6009ed17746"}
|
1
.c9/metadata/workspace/routes/index.js
Normal file
1
.c9/metadata/workspace/routes/index.js
Normal file
File diff suppressed because one or more lines are too long
1
.c9/metadata/workspace/test.sh
Normal file
1
.c9/metadata/workspace/test.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"filter":false,"title":"test.sh","tooltip":"/test.sh","undoManager":{"mark":33,"position":33,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["e"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["c"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["h"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["o"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":[" "],"id":5}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":7},"action":"insert","lines":["\"\""],"id":6}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["s"],"id":7},{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["d"]}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["f"],"id":8}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["s"],"id":9}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["d"],"id":10}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["f"],"id":11}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["s"],"id":12},{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["d"]}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":[">"],"id":13}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["t"],"id":14}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["e"],"id":15}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["s"],"id":16}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["t"],"id":17}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["."],"id":18}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["t"],"id":19}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":["x"],"id":20}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["t"],"id":21}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":22}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["#"],"id":23}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["!"],"id":24}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["/"],"id":25}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["b"],"id":26}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["i"],"id":27}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["n"],"id":28}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["/"],"id":29}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["b"],"id":30}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["a"],"id":31}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["s"],"id":32}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["h"],"id":33}],[{"start":{"row":0,"column":11},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":34}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":1,"column":0},"end":{"row":1,"column":0},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1452978488496,"hash":"e5d88869a1d8eada9039d48fcf70c2dd29272ac7"}
|
34
.c9/project.settings
Normal file
34
.c9/project.settings
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"ace": {
|
||||||
|
"@guessTabSize": "true",
|
||||||
|
"@newLineMode": "unix",
|
||||||
|
"@tabSize": "4",
|
||||||
|
"@useSoftTabs": "true"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"@builder": "auto",
|
||||||
|
"@path": "/.c9/builders",
|
||||||
|
"@saveall": "true"
|
||||||
|
},
|
||||||
|
"find.nak": {
|
||||||
|
"@searchLimit": 100
|
||||||
|
},
|
||||||
|
"general": {
|
||||||
|
"@stripws": false
|
||||||
|
},
|
||||||
|
"language": {
|
||||||
|
"@eslintrc": "true",
|
||||||
|
"@instanceHighlight": "true",
|
||||||
|
"@semi": "true",
|
||||||
|
"@undeclaredVars": "true",
|
||||||
|
"@unusedFunctionArgs": "false",
|
||||||
|
"@warnLevel": "info"
|
||||||
|
},
|
||||||
|
"run": {
|
||||||
|
"@path": "/.c9/runners",
|
||||||
|
"configs": {
|
||||||
|
"@inited": "true",
|
||||||
|
"json()": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
265
.c9/state.settings
Normal file
265
.c9/state.settings
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
{
|
||||||
|
"console": {
|
||||||
|
"@expanded": true,
|
||||||
|
"@height": 269,
|
||||||
|
"@maximized": "false",
|
||||||
|
"json()": {
|
||||||
|
"meta": {
|
||||||
|
"accessList": [
|
||||||
|
"tab8",
|
||||||
|
"tab1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "pane1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"type": "tab",
|
||||||
|
"name": "tab1",
|
||||||
|
"path": "",
|
||||||
|
"className": [
|
||||||
|
"tab1"
|
||||||
|
],
|
||||||
|
"document": {
|
||||||
|
"filter": true,
|
||||||
|
"title": "Immediate (Javascript (browser))",
|
||||||
|
"tooltip": "Immediate (Javascript (browser))",
|
||||||
|
"immediate": {
|
||||||
|
"folds": [],
|
||||||
|
"scrolltop": 0,
|
||||||
|
"scrollleft": 0,
|
||||||
|
"selection": {
|
||||||
|
"start": {
|
||||||
|
"row": 8,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"row": 8,
|
||||||
|
"column": 21
|
||||||
|
},
|
||||||
|
"isBackwards": true
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"guessTabSize": true,
|
||||||
|
"useWrapMode": false,
|
||||||
|
"wrapToView": true
|
||||||
|
},
|
||||||
|
"firstLineState": 0,
|
||||||
|
"type": "jsbrowser",
|
||||||
|
"history": [
|
||||||
|
"\"refs/heads/template\".match(/\\/master$/)",
|
||||||
|
"\"refs/heads/master\".match(/\\/master$/)",
|
||||||
|
"s.match(/\\/master$/)",
|
||||||
|
"s = \"refs/heads/master\""
|
||||||
|
],
|
||||||
|
"pos": -1
|
||||||
|
},
|
||||||
|
"hash": "722c479a340a3da2396735615b87d31f3373e145",
|
||||||
|
"meta": {
|
||||||
|
"timestamp": 1452973618356
|
||||||
|
},
|
||||||
|
"changed": false
|
||||||
|
},
|
||||||
|
"editorType": "immediate",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tab",
|
||||||
|
"name": "tab8",
|
||||||
|
"path": "",
|
||||||
|
"className": [
|
||||||
|
"tab8",
|
||||||
|
"focus"
|
||||||
|
],
|
||||||
|
"document": {
|
||||||
|
"changed": false,
|
||||||
|
"meta": {
|
||||||
|
"timestamp": 1452978225696
|
||||||
|
},
|
||||||
|
"filter": true,
|
||||||
|
"title": "Terminal",
|
||||||
|
"terminal": {
|
||||||
|
"id": "devel_232",
|
||||||
|
"cwd": "",
|
||||||
|
"width": 1328,
|
||||||
|
"height": 243
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"editorType": "terminal",
|
||||||
|
"active": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"skin": "editor_tab",
|
||||||
|
"skinset": "default",
|
||||||
|
"type": "pane"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"experiments": {
|
||||||
|
"@@enabled": true,
|
||||||
|
"@flat-dark": 0,
|
||||||
|
"@git": 1,
|
||||||
|
"@mount": 0,
|
||||||
|
"@plugin-manager": 0,
|
||||||
|
"@plugins": 0,
|
||||||
|
"@sdk": 0,
|
||||||
|
"@test": 0
|
||||||
|
},
|
||||||
|
"ext": {
|
||||||
|
"counters": {
|
||||||
|
"@ace": 1,
|
||||||
|
"@acestatus": 1,
|
||||||
|
"@divider": 5,
|
||||||
|
"@document": 6,
|
||||||
|
"@form": 5,
|
||||||
|
"@immediate": 1,
|
||||||
|
"@menu": 7,
|
||||||
|
"@menuitem": 17,
|
||||||
|
"@pane": 2,
|
||||||
|
"@session": 5,
|
||||||
|
"@tab": 1,
|
||||||
|
"@undoManager": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"findinfiles": {
|
||||||
|
"@console": "true",
|
||||||
|
"@matchcase": "false",
|
||||||
|
"@regex": "false",
|
||||||
|
"@wholeword": "false"
|
||||||
|
},
|
||||||
|
"menus": {
|
||||||
|
"@minimized": "false"
|
||||||
|
},
|
||||||
|
"nak": {
|
||||||
|
"@installed": true
|
||||||
|
},
|
||||||
|
"panecycle": {
|
||||||
|
"json()": [
|
||||||
|
"tab8",
|
||||||
|
"tab6"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"panels": {
|
||||||
|
"@active-left": "tree",
|
||||||
|
"@active-right": "none",
|
||||||
|
"commands.panel": {
|
||||||
|
"@enabled": "true",
|
||||||
|
"@name": "commands.panel"
|
||||||
|
},
|
||||||
|
"debugger": {
|
||||||
|
"@enabled": "true",
|
||||||
|
"@name": "debugger"
|
||||||
|
},
|
||||||
|
"navigate": {
|
||||||
|
"@enabled": "true",
|
||||||
|
"@name": "navigate"
|
||||||
|
},
|
||||||
|
"outline": {
|
||||||
|
"@enabled": "true",
|
||||||
|
"@name": "outline"
|
||||||
|
},
|
||||||
|
"scm": {
|
||||||
|
"@enabled": "true",
|
||||||
|
"@name": "scm"
|
||||||
|
},
|
||||||
|
"tree": {
|
||||||
|
"@enabled": "true",
|
||||||
|
"@name": "tree"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"projecttree": {
|
||||||
|
"@showfs": true,
|
||||||
|
"expanded": {
|
||||||
|
"json()": [
|
||||||
|
"/",
|
||||||
|
"/bin",
|
||||||
|
"/routes"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"recentfiles": {
|
||||||
|
"json()": []
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"json()": {
|
||||||
|
"focus": "/routes/index.js",
|
||||||
|
"meta": {
|
||||||
|
"accessList": [
|
||||||
|
"tab6",
|
||||||
|
"tab0",
|
||||||
|
"tab3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "pane0",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"type": "tab",
|
||||||
|
"name": "tab3",
|
||||||
|
"path": "/bin/www",
|
||||||
|
"className": [
|
||||||
|
"tab3"
|
||||||
|
],
|
||||||
|
"document": {
|
||||||
|
"meta": {
|
||||||
|
"timestamp": 1452973671206
|
||||||
|
},
|
||||||
|
"filter": true,
|
||||||
|
"title": "www",
|
||||||
|
"tooltip": "/bin/www",
|
||||||
|
"ace": {},
|
||||||
|
"changed": false
|
||||||
|
},
|
||||||
|
"editorType": "ace",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tab",
|
||||||
|
"name": "tab6",
|
||||||
|
"path": "/routes/index.js",
|
||||||
|
"className": [
|
||||||
|
"tab6",
|
||||||
|
"focus"
|
||||||
|
],
|
||||||
|
"document": {
|
||||||
|
"changed": false,
|
||||||
|
"meta": {
|
||||||
|
"timestamp": 1452975302950
|
||||||
|
},
|
||||||
|
"filter": true,
|
||||||
|
"title": "index.js",
|
||||||
|
"tooltip": "/routes/index.js",
|
||||||
|
"ace": {}
|
||||||
|
},
|
||||||
|
"editorType": "ace",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tab",
|
||||||
|
"name": "tab0",
|
||||||
|
"path": "/test.sh",
|
||||||
|
"className": [
|
||||||
|
"tab0"
|
||||||
|
],
|
||||||
|
"document": {
|
||||||
|
"changed": false,
|
||||||
|
"meta": {
|
||||||
|
"timestamp": 1452978488496
|
||||||
|
},
|
||||||
|
"filter": true,
|
||||||
|
"title": "test.sh",
|
||||||
|
"tooltip": "/test.sh",
|
||||||
|
"ace": {}
|
||||||
|
},
|
||||||
|
"editorType": "ace",
|
||||||
|
"active": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"skin": "editor_tab",
|
||||||
|
"skinset": "default",
|
||||||
|
"type": "pane"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tree_selection": {
|
||||||
|
"json()": [
|
||||||
|
"/routes/index.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,5 +28,3 @@ node_modules
|
|||||||
|
|
||||||
# Debug log from npm
|
# Debug log from npm
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
settings.json
|
|
||||||
|
11
app.js
11
app.js
@ -5,12 +5,14 @@ var logger = require('morgan');
|
|||||||
var cookieParser = require('cookie-parser');
|
var cookieParser = require('cookie-parser');
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
|
var routes = require('./routes/index');
|
||||||
|
var users = require('./routes/users');
|
||||||
|
|
||||||
var app = express();
|
var app = express();
|
||||||
app.settings = require('./settings.json');
|
|
||||||
// view engine setup
|
// view engine setup
|
||||||
// app.set('views', path.join(__dirname, 'views'));
|
app.set('views', path.join(__dirname, 'views'));
|
||||||
// app.set('view engine', 'ejs');
|
app.set('view engine', 'ejs');
|
||||||
|
|
||||||
// uncomment after placing your favicon in /public
|
// uncomment after placing your favicon in /public
|
||||||
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
||||||
@ -20,7 +22,8 @@ app.use(bodyParser.urlencoded({ extended: false }));
|
|||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
require('./routes/index')(app);
|
app.use('/', routes);
|
||||||
|
app.use('/users', users);
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
// catch 404 and forward to error handler
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
|
68
create.sh
68
create.sh
@ -1,88 +1,52 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
name="$1"
|
name="$1"
|
||||||
sshURL="$2"
|
sshURL="$2"
|
||||||
nodePort=`python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'`
|
|
||||||
workingPath=/var/www/gitwrapper/$name
|
|
||||||
|
|
||||||
echo "starting $sshURL on $name"
|
nodePort=`./random_port.py`
|
||||||
|
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
ssh-add /root/.ssh/id_github_rsa
|
ssh-add /root/.ssh/id_github_rsa
|
||||||
mkdir $workingPath
|
mkdir /var/www/gitwrapper/$name
|
||||||
cd $workingPath
|
cd /var/www/gitwrapper/$name
|
||||||
chmod 777 .
|
chmod 777 .
|
||||||
echo `pwd`
|
echo `pwd`
|
||||||
|
|
||||||
DJANGO_SETTINGS_MODULE=project.settings.prod
|
DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
|
|
||||||
NODE_ENV='staging'
|
|
||||||
export NODE_ENV='staging'
|
|
||||||
export NODEPORT=$nodePort
|
|
||||||
export djangoURL="http://$name.staging.bytedev.co"
|
|
||||||
|
|
||||||
git clone $sshURL .
|
git clone $sshURL .
|
||||||
|
|
||||||
echo "creating apache VirtualHost file and showing down"
|
|
||||||
|
|
||||||
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " ServerName $name.staging.bytedev.co" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " DocumentRoot $workingPath/static/error_pages" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
|
|
||||||
/usr/sbin/service apache2 reload
|
|
||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
|
|
||||||
source env/bin/activate
|
|
||||||
|
|
||||||
cp /var/www/local_settings.py project/settings/local_settings.py
|
cp /var/www/local_settings.py project/settings/local_settings.py
|
||||||
echo "BRANCH='$name'" >> project/settings/local_settings.py
|
echo "BRANCH = '$name'" >> project/settings/local_settings.py
|
||||||
echo "NODEPORT='$nodePort'" >> project/settings/local_settings.py
|
|
||||||
echo $nodePort > env/nodePort
|
|
||||||
|
|
||||||
echo "checking out to prod for set up"
|
# set up project from prod, load database
|
||||||
git checkout prod
|
git checkout prod
|
||||||
|
|
||||||
python3 manage.py createcachetable
|
./manage.py createcachetable
|
||||||
python3 manage.py migrate
|
./manage.py migrate
|
||||||
python3 manage.py loaddata /var/www/django.json
|
./manage.py loaddata /var/www/django.json
|
||||||
|
|
||||||
echo "checking out to $name for set up"
|
|
||||||
git checkout $name
|
git checkout $name
|
||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
|
|
||||||
python3 manage.py collectstatic --noinput
|
# python3 manage.py collectstatic --noinput
|
||||||
python3 manage.py migrate
|
./manage.py migrate
|
||||||
chmod 777 db.sqlite3
|
chmod 777 db.sqlite3
|
||||||
chmod 777 -R .track-storage
|
|
||||||
|
|
||||||
forever stop $workingPath/node_rtc/app.js
|
|
||||||
echo "starting node app on port $nodePort"
|
|
||||||
forever start $workingPath/node_rtc/app.js
|
|
||||||
|
|
||||||
echo "creating apache VirtualHost file"
|
|
||||||
|
|
||||||
|
# set up apache vhost
|
||||||
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/$name.conf
|
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " ServerName $name.staging.bytedev.co" >> /etc/apache2/sites-enabled/$name.conf
|
echo " ServerName $name.staging.bytedev.co" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " Alias /static $workingPath/staticfiles" >> /etc/apache2/sites-enabled/$name.conf
|
echo " Alias /static /var/www/gitwrapper/$name/staticfiles" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$workingPath/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf
|
echo " WSGIDaemonProcess $name python-path=/var/www/gitwrapper/$name:/var/www/gitwrapper/$name/env:/var/www/gitwrapper/$name/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf
|
echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf
|
echo " WSGIScriptAlias / /var/www/gitwrapper/$name/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
|
|
||||||
echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " RewriteCond %{HTTP:UPGRADE} ^WebSocket\$ [NC]" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " RewriteCond %{HTTP:CONNECTION} Upgrade\$ [NC]" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " RewriteRule .* ws://localhost:$nodePort%{REQUEST_URI} [P]" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " RewriteCond %{REQUEST_URI} ^/socket.io/\$1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " RewriteRule socket.io/(.*) ws://localhost:$nodePort/socket.io/\$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " ProxyPass /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
echo " ProxyPassReverse /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf
|
|
||||||
|
|
||||||
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
|
|
||||||
/usr/sbin/service apache2 reload
|
/usr/sbin/service apache2 restart
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
name="$1"
|
name="$1"
|
||||||
sshURL="$2"
|
sshURL="$2"
|
||||||
workingPath=/var/www/gitwrapper/$name
|
|
||||||
|
|
||||||
|
|
||||||
nodePort=`cat $workingPath/env/nodePort`
|
|
||||||
export NODEPORT=$nodePort
|
|
||||||
forever stop $workingPath/node_rtc/app.js
|
|
||||||
|
|
||||||
rm -rf /var/www/gitwrapper/$name
|
rm -rf /var/www/gitwrapper/$name
|
||||||
rm /etc/apache2/sites-enabled/$name.conf
|
rm /etc/apache2/sites-enabled/$name.conf
|
||||||
|
|
||||||
|
|
||||||
/usr/sbin/service apache2 restart
|
/usr/sbin/service apache2 restart
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
8
public/stylesheets/style.css
Normal file
8
public/stylesheets/style.css
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
body {
|
||||||
|
padding: 50px;
|
||||||
|
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #00B7FF;
|
||||||
|
}
|
@ -10,21 +10,18 @@ var install_dir = '/var/www/gitwrapper/'
|
|||||||
|
|
||||||
var calls = {
|
var calls = {
|
||||||
create: function(req, res, name, sshURL){
|
create: function(req, res, name, sshURL){
|
||||||
console.log("create =========================");
|
|
||||||
return exec('bash /var/www/gitdeploy/create.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
return exec('bash /var/www/gitdeploy/create.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||||
console.log(err, stdout, stderr);
|
console.log(err, stdout, stderr);
|
||||||
return res.json({ title: stdout });
|
return res.json({ title: stdout });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
update: function(req, res, name, sshURL){
|
update: function(req, res, name, sshURL){
|
||||||
console.log("update =========================");
|
|
||||||
return exec('bash /var/www/gitdeploy/update.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
return exec('bash /var/www/gitdeploy/update.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||||
console.log(err, stdout, stderr);
|
console.log(err, stdout, stderr);
|
||||||
return res.json({ title: stdout });
|
return res.json({ title: stdout });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
delete: function(req, res, name, sshURL){
|
delete: function(req, res, name, sshURL){
|
||||||
console.log("delete =========================");
|
|
||||||
return exec('bash /var/www/gitdeploy/delete.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
return exec('bash /var/www/gitdeploy/delete.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||||
console.log(err, stdout, stderr);
|
console.log(err, stdout, stderr);
|
||||||
return res.json({ title: stdout });
|
return res.json({ title: stdout });
|
||||||
|
9
routes/users.js
Normal file
9
routes/users.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
var express = require('express');
|
||||||
|
var router = express.Router();
|
||||||
|
|
||||||
|
/* GET users listing. */
|
||||||
|
router.get('/', function(req, res, next) {
|
||||||
|
res.send('respond with a resource');
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
@ -1,10 +0,0 @@
|
|||||||
name="$1";
|
|
||||||
sshURL="$2";
|
|
||||||
install_dir="$3";
|
|
||||||
|
|
||||||
mkdir -p $install_dir;
|
|
||||||
cd $install_dir;
|
|
||||||
|
|
||||||
git clone $install_dir;
|
|
||||||
git fetch origin $name:$name;
|
|
||||||
exit 0;
|
|
17
update.sh
17
update.sh
@ -1,22 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
name="$1"
|
name="$1"
|
||||||
sshURL="$2"
|
sshURL="$2"
|
||||||
install_dir="$3"
|
|
||||||
|
|
||||||
|
# set up git to auth
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
ssh-add /root/.ssh/id_github_rsa
|
ssh-add /root/.ssh/id_github_rsa
|
||||||
cd $install_dir
|
|
||||||
|
|
||||||
|
|
||||||
DJANGO_SETTINGS_MODULE=project.settings.prod
|
DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
source env/bin/activate
|
|
||||||
|
|
||||||
|
cd /var/www/gitwrapper/$name
|
||||||
git stash
|
git stash
|
||||||
git pull --force origin $name
|
git pull --force origin $name
|
||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
source env/bin/activate
|
|
||||||
|
|
||||||
python3 manage.py collectstatic --noinput
|
python3 manage.py collectstatic --noinput
|
||||||
python3 manage.py migrate
|
python3 manage.py migrate
|
||||||
@ -24,16 +21,6 @@ python3 manage.py migrate
|
|||||||
chmod 777 .
|
chmod 777 .
|
||||||
chmod 777 db.sqlite3
|
chmod 777 db.sqlite3
|
||||||
|
|
||||||
echo "starting node app"
|
|
||||||
NODE_ENV='staging'
|
|
||||||
export NODE_ENV='staging'
|
|
||||||
nodePort=`cat env/nodePort`
|
|
||||||
export NODEPORT=$nodePort
|
|
||||||
export djangoURL="http://$name.staging.bytedev.co"
|
|
||||||
|
|
||||||
forever stop $install_dir/node_rtc/app.js
|
|
||||||
forever start $install_dir/node_rtc/app.js
|
|
||||||
|
|
||||||
/usr/sbin/service apache2 restart
|
/usr/sbin/service apache2 restart
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
3
views/error.ejs
Normal file
3
views/error.ejs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<h1><%= message %></h1>
|
||||||
|
<h2><%= error.status %></h2>
|
||||||
|
<pre><%= error.stack %></pre>
|
11
views/index.ejs
Normal file
11
views/index.ejs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><%= title %></title>
|
||||||
|
<link rel='stylesheet' href='/stylesheets/style.css' />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1><%= title %></h1>
|
||||||
|
<p>Welcome to <%= title %></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user