new stuf
This commit is contained in:
parent
0fc95da317
commit
c3293e1ec4
@ -1,17 +0,0 @@
|
||||
*~backup-*
|
||||
.c9revisions
|
||||
.c9
|
||||
.git
|
||||
.svn
|
||||
.DS_Store
|
||||
.bzr
|
||||
.cdv
|
||||
~.dep
|
||||
~.dot
|
||||
~.nib
|
||||
~.plst
|
||||
.hg
|
||||
.pc
|
||||
*.min.js
|
||||
.nakignore
|
||||
/dev
|
@ -1 +0,0 @@
|
||||
{"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 +0,0 @@
|
||||
{"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 +0,0 @@
|
||||
{"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"}
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"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"}
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
"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()": {}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,265 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
57
app.js
57
app.js
@ -1,29 +1,10 @@
|
||||
var express = require('express');
|
||||
var path = require('path');
|
||||
var favicon = require('serve-favicon');
|
||||
var logger = require('morgan');
|
||||
var cookieParser = require('cookie-parser');
|
||||
var bodyParser = require('body-parser');
|
||||
'use strict';
|
||||
|
||||
var routes = require('./routes/index');
|
||||
var users = require('./routes/users');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
var app = express();
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', routes);
|
||||
app.use('/users', users);
|
||||
app.use(express.json());
|
||||
app.use('/', require('./routes/index'));
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
@ -32,29 +13,15 @@ app.use(function(req, res, next) {
|
||||
next(err);
|
||||
});
|
||||
|
||||
// error handlers
|
||||
|
||||
// development error handler
|
||||
// will print stacktrace
|
||||
if (app.get('env') === 'development') {
|
||||
app.use(function(err, req, res, next) {
|
||||
res.status(err.status || 500);
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
error: err
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// production error handler
|
||||
// no stacktraces leaked to user
|
||||
// error handler
|
||||
app.use(function(err, req, res, next) {
|
||||
// set locals, only providing error in development
|
||||
res.locals.message = err.message;
|
||||
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||
|
||||
// render the error page
|
||||
res.status(err.status || 500);
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
error: {}
|
||||
});
|
||||
res.json({message: 'error!'});
|
||||
});
|
||||
|
||||
|
||||
module.exports = app;
|
||||
|
88
create.sh
88
create.sh
@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
name="$1"
|
||||
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"
|
||||
|
||||
eval "$(ssh-agent -s)"
|
||||
ssh-add /root/.ssh/id_github_rsa
|
||||
mkdir $workingPath
|
||||
cd $workingPath
|
||||
chmod 777 .
|
||||
echo `pwd`
|
||||
|
||||
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 .
|
||||
|
||||
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
|
||||
|
||||
source env/bin/activate
|
||||
|
||||
cp /var/www/local_settings.py 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"
|
||||
git checkout prod
|
||||
|
||||
python3 manage.py createcachetable
|
||||
python3 manage.py migrate
|
||||
python3 manage.py loaddata /var/www/django.json
|
||||
|
||||
echo "checking out to $name for set up"
|
||||
git checkout $name
|
||||
|
||||
./scripts/setup.sh
|
||||
|
||||
python3 manage.py collectstatic --noinput
|
||||
python3 manage.py migrate
|
||||
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"
|
||||
|
||||
echo "<VirtualHost *:80>" > /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 " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$workingPath/env/lib/python3.5/site-packages" >> /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 " # 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
|
||||
|
||||
/usr/sbin/service apache2 reload
|
||||
|
||||
exit 0
|
17
delete.sh
17
delete.sh
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
name="$1"
|
||||
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 /etc/apache2/sites-enabled/$name.conf
|
||||
|
||||
|
||||
/usr/sbin/service apache2 restart
|
||||
|
||||
exit 0
|
10
package.json
10
package.json
@ -6,12 +6,6 @@
|
||||
"start": "node ./bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "~1.13.2",
|
||||
"cookie-parser": "~1.3.5",
|
||||
"debug": "~2.2.0",
|
||||
"ejs": "~2.3.3",
|
||||
"express": "~4.13.1",
|
||||
"morgan": "~1.6.1",
|
||||
"serve-favicon": "~2.3.0"
|
||||
"express": "^4.16.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00B7FF;
|
||||
}
|
@ -1,16 +1,40 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var exec = require('child_process').exec;
|
||||
'use strict';
|
||||
|
||||
const router = require('express').Router();
|
||||
|
||||
const {exec} = require('child_process');
|
||||
var fs = require('fs');
|
||||
/* GET home page. */
|
||||
|
||||
var install_dir = '/var/www/gitwrapper/'
|
||||
|
||||
|
||||
// function lxc_create(name, callback) {
|
||||
// exec('lxc-create', [
|
||||
// '-n', 'name_'+(Math.random()*100).toString().slice(-4),
|
||||
// '-t' 'download', '--',
|
||||
// '--dist', 'ubuntu',
|
||||
// '--release', 'xenial',
|
||||
// '--arch', 'amd64']
|
||||
// function(err, stdout, stderr){
|
||||
|
||||
// });
|
||||
// }
|
||||
|
||||
var calls = {
|
||||
create: function(req, res, name, sshURL){
|
||||
console.log("create =========================");
|
||||
// create new container
|
||||
// install git in container
|
||||
// seed container with deploy key
|
||||
// clone repo into container
|
||||
// run <repo>/scripts/deploy/create
|
||||
// add entry to proxy
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return exec('bash /var/www/gitdeploy/create.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||
console.log(err, stdout, stderr);
|
||||
return res.json({ title: stdout });
|
||||
@ -40,11 +64,13 @@ router.all('/', function(req, res, next) {
|
||||
(req.body.deleted && 'delete') ||
|
||||
'update';
|
||||
|
||||
var name = req.body.ref.replace('refs/heads/', '');
|
||||
var branch = req.body.ref.replace('refs/heads/', '');
|
||||
var sshURL = req.body.repository.ssh_url;
|
||||
if(call === 'update' && !fs.existsSync('/var/www/gitwrapper/'+name)) call = 'create';
|
||||
|
||||
return calls[call](req, res, name, sshURL);
|
||||
console.log('body');
|
||||
|
||||
// return calls[call](req, res, branch, sshURL);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
@ -1,9 +0,0 @@
|
||||
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,3 +0,0 @@
|
||||
<h1><%= message %></h1>
|
||||
<h2><%= error.status %></h2>
|
||||
<pre><%= error.stack %></pre>
|
@ -1,11 +0,0 @@
|
||||
<!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>
|
Loading…
x
Reference in New Issue
Block a user