1
Fork 0

change deployment process for dokku

This commit is contained in:
Jake Howard 2016-08-13 20:08:43 +01:00
parent 600c5595d2
commit ad153f7ec5
Signed by: jake
GPG key ID: 57AFB45680EDD477
9 changed files with 20 additions and 61 deletions

View file

@ -1,3 +0,0 @@
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-python
https://github.com/RealOrangeOne/heroku-buildpack-make

1
.gitignore vendored
View file

@ -63,3 +63,4 @@ theme/static/build/
pelican_plugins/ pelican_plugins/
theme/static/src/scss/pygment.css theme/static/src/scss/pygment.css
deploy/

View file

@ -1,13 +1,11 @@
NODE_BIN=node_modules/.bin
PELICAN=pelican
BASEDIR=$(PWD) BASEDIR=$(PWD)
ENV=$(BASEDIR)/env/bin
NODE_BIN=node_modules/.bin
PELICAN=$(ENV)/pelican
OUTPUTDIR=$(BASEDIR)/output OUTPUTDIR=$(BASEDIR)/output
PLUGINS_DIR=$(BASEDIR)/pelican_plugins PLUGINS_DIR=$(BASEDIR)/pelican_plugins
DEPLOY_DIR=$(BASEDIR)/deploy
SSH_USER=web
SSH_HOST=theorangeone.net
SSH_TARGET_DIR=/home/web/v4-theorangeone.net/site # Dev path only!
FLAKE8_IGNORE=--ignore=E128,E501,E401,E402 FLAKE8_IGNORE=--ignore=E128,E501,E401,E402
@ -42,7 +40,7 @@ pelican_plugins:
env: env:
pyvenv env pyvenv env
pip install -r requirements.txt $(ENV)/pip install -r requirements.txt
node_modules: node_modules:
npm install npm install
@ -53,9 +51,9 @@ test: lint spellcheck
lint: lint:
$(NODE_BIN)/eslint 'theme/static/src/js/' $(NODE_BIN)/eslint 'theme/static/src/js/'
$(NODE_BIN)/sass-lint -vqc .sass-lint.yml $(NODE_BIN)/sass-lint -vqc .sass-lint.yml
flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE) $(ENV)/flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE) $(ENV)/flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
flake8 $(BASEDIR)/pelicanconf.py $(FLAKE8_IGNORE) $(ENV)/flake8 $(BASEDIR)/pelicanconf.py $(FLAKE8_IGNORE)
spellcheck: spellcheck:
$(NODE_BIN)/mdspell --en-gb -ranx theme/templates/**/*.* theme/templates/*.* $(NODE_BIN)/mdspell --en-gb -ranx theme/templates/**/*.* theme/templates/*.*
@ -63,7 +61,10 @@ spellcheck:
upload: build upload: build
rsync -e "/usr/bin/ssh" -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) git clone https://github.com/RealOrangeOne/host-container.git $(DEPLOY_DIR)
cp -rf $(OUTPUTDIR)/* $(DEPLOY_DIR)/site/
cd $(DEPLOY_DIR) && git remote add dokku $(DEPLOY_URL) && git add . && git commit -m "add files" && git push -f dokku master
rm -rf $(DEPLOY_DIR)
.PHONY: build clean test lint install upload .PHONY: build clean test lint install upload

View file

@ -1 +0,0 @@
web: npm start

View file

@ -1 +1 @@
web: npm start web: bash scripts/server.sh

View file

@ -4,20 +4,15 @@
"description": " Source code for TheOrangeOne.net", "description": " Source code for TheOrangeOne.net",
"scripts": { "scripts": {
"build-js": "./scripts/build-js.sh", "build-js": "./scripts/build-js.sh",
"build-scss": "./scripts/build-scss.sh", "build-scss": "./scripts/build-scss.sh"
"start": "node scripts/server.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/RealOrangeOne/theorangeone.net" "url": "https://github.com/RealOrangeOne/theorangeone.net"
}, },
"engines": {
"node": "5.11.1"
},
"dependencies": { "dependencies": {
"animate.css": "=3.5.1", "animate.css": "=3.5.1",
"bootstrap-sass": "=3.3.7", "bootstrap-sass": "=3.3.7",
"express": "=4.14.0",
"font-awesome": "=4.6.3", "font-awesome": "=4.6.3",
"jquery": "=2.2.3", "jquery": "=2.2.3",
"jquery.easing": "=1.3.2", "jquery.easing": "=1.3.2",

View file

@ -1 +0,0 @@
python-3.5.1

View file

@ -1,37 +0,0 @@
const express = require('express');
const PORT = process.env.PORT;
const serveDir = __dirname + '/../output';
const directory = /\/$/;
const allFiles = /.*/;
const expressConfig = {
dotfiles: 'deny',
index: false,
redirect: true
};
const app = express();
app.use(function (request, response, next) {
// If path is directory then serve index.html
if (directory.exec(request.url)) {
request.url += '/index.html';
}
next();
});
app.use(
express.static(serveDir, expressConfig)
);
// Cannot find any file
app.use(
allFiles, express.static(serveDir + '/.404.html', expressConfig)
);
const server = app.listen(PORT, function () {
const serverPort = server.address().port;
console.log('Server started on port ' + serverPort);
});

4
scripts/server.sh Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd output/
python3 -m pelican.server $PORT