change deployment process for dokku
This commit is contained in:
parent
600c5595d2
commit
ad153f7ec5
9 changed files with 20 additions and 61 deletions
|
@ -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
1
.gitignore
vendored
|
@ -63,3 +63,4 @@ theme/static/build/
|
|||
pelican_plugins/
|
||||
|
||||
theme/static/src/scss/pygment.css
|
||||
deploy/
|
||||
|
|
25
Makefile
25
Makefile
|
@ -1,13 +1,11 @@
|
|||
NODE_BIN=node_modules/.bin
|
||||
PELICAN=pelican
|
||||
|
||||
BASEDIR=$(PWD)
|
||||
ENV=$(BASEDIR)/env/bin
|
||||
NODE_BIN=node_modules/.bin
|
||||
PELICAN=$(ENV)/pelican
|
||||
|
||||
OUTPUTDIR=$(BASEDIR)/output
|
||||
PLUGINS_DIR=$(BASEDIR)/pelican_plugins
|
||||
|
||||
SSH_USER=web
|
||||
SSH_HOST=theorangeone.net
|
||||
SSH_TARGET_DIR=/home/web/v4-theorangeone.net/site # Dev path only!
|
||||
DEPLOY_DIR=$(BASEDIR)/deploy
|
||||
|
||||
FLAKE8_IGNORE=--ignore=E128,E501,E401,E402
|
||||
|
||||
|
@ -42,7 +40,7 @@ pelican_plugins:
|
|||
|
||||
env:
|
||||
pyvenv env
|
||||
pip install -r requirements.txt
|
||||
$(ENV)/pip install -r requirements.txt
|
||||
|
||||
node_modules:
|
||||
npm install
|
||||
|
@ -53,9 +51,9 @@ test: lint spellcheck
|
|||
lint:
|
||||
$(NODE_BIN)/eslint 'theme/static/src/js/'
|
||||
$(NODE_BIN)/sass-lint -vqc .sass-lint.yml
|
||||
flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
|
||||
flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
|
||||
flake8 $(BASEDIR)/pelicanconf.py $(FLAKE8_IGNORE)
|
||||
$(ENV)/flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
|
||||
$(ENV)/flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
|
||||
$(ENV)/flake8 $(BASEDIR)/pelicanconf.py $(FLAKE8_IGNORE)
|
||||
|
||||
spellcheck:
|
||||
$(NODE_BIN)/mdspell --en-gb -ranx theme/templates/**/*.* theme/templates/*.*
|
||||
|
@ -63,7 +61,10 @@ spellcheck:
|
|||
|
||||
|
||||
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
|
||||
|
|
1
Procfile
1
Procfile
|
@ -1 +0,0 @@
|
|||
web: npm start
|
|
@ -1 +1 @@
|
|||
web: npm start
|
||||
web: bash scripts/server.sh
|
||||
|
|
|
@ -4,20 +4,15 @@
|
|||
"description": " Source code for TheOrangeOne.net",
|
||||
"scripts": {
|
||||
"build-js": "./scripts/build-js.sh",
|
||||
"build-scss": "./scripts/build-scss.sh",
|
||||
"start": "node scripts/server.js"
|
||||
"build-scss": "./scripts/build-scss.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/RealOrangeOne/theorangeone.net"
|
||||
},
|
||||
"engines": {
|
||||
"node": "5.11.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"animate.css": "=3.5.1",
|
||||
"bootstrap-sass": "=3.3.7",
|
||||
"express": "=4.14.0",
|
||||
"font-awesome": "=4.6.3",
|
||||
"jquery": "=2.2.3",
|
||||
"jquery.easing": "=1.3.2",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
python-3.5.1
|
|
@ -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
4
scripts/server.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd output/
|
||||
python3 -m pelican.server $PORT
|
Reference in a new issue