get ready for deployment
This commit is contained in:
parent
d4f8915de7
commit
b809cf06b4
7 changed files with 53 additions and 15 deletions
3
.buildpacks
Normal file
3
.buildpacks
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
https://github.com/heroku/heroku-buildpack-nodejs
|
||||||
|
https://github.com/heroku/heroku-buildpack-python
|
||||||
|
https://github.com/RealOrangeOne/heroku-buildpack-make
|
17
Makefile
17
Makefile
|
@ -1,6 +1,5 @@
|
||||||
ENV=env/bin
|
|
||||||
NODE_BIN=node_modules/.bin
|
NODE_BIN=node_modules/.bin
|
||||||
PELICAN=$(ENV)/pelican
|
PELICAN=pelican
|
||||||
|
|
||||||
BASEDIR=$(PWD)
|
BASEDIR=$(PWD)
|
||||||
OUTPUTDIR=$(BASEDIR)/output
|
OUTPUTDIR=$(BASEDIR)/output
|
||||||
|
@ -32,9 +31,9 @@ clean:
|
||||||
rm -rf $(PLUGINS_DIR)/*
|
rm -rf $(PLUGINS_DIR)/*
|
||||||
|
|
||||||
|
|
||||||
install: env node_modules pelican_plugins
|
install: node_modules pelican_plugins
|
||||||
|
|
||||||
pelican_plugins: env
|
pelican_plugins:
|
||||||
rm -rf $(PLUGINS_DIR) || "No existing extensions"
|
rm -rf $(PLUGINS_DIR) || "No existing extensions"
|
||||||
git clone --recursive https://github.com/getpelican/pelican-plugins $(PLUGINS_DIR) || "Git Fail"
|
git clone --recursive https://github.com/getpelican/pelican-plugins $(PLUGINS_DIR) || "Git Fail"
|
||||||
@echo ">> Hotfixing..."
|
@echo ">> Hotfixing..."
|
||||||
|
@ -43,9 +42,9 @@ pelican_plugins: env
|
||||||
|
|
||||||
env:
|
env:
|
||||||
pyvenv env
|
pyvenv env
|
||||||
$(ENV)/pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
node_modules: env
|
node_modules:
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,9 +53,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
|
||||||
$(ENV)/flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
|
flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
|
||||||
$(ENV)/flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
|
flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
|
||||||
$(ENV)/flake8 $(BASEDIR)/pelicanconf.py $(FLAKE8_IGNORE)
|
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/*.*
|
||||||
|
|
1
Procfile
Normal file
1
Procfile
Normal file
|
@ -0,0 +1 @@
|
||||||
|
web: npm start
|
|
@ -1 +1 @@
|
||||||
web: bash scripts/server.sh
|
web: npm start
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"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",
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"animate.css": "=3.5.1",
|
"animate.css": "=3.5.1",
|
||||||
"bootstrap-sass": "=3.3.6",
|
"bootstrap-sass": "=3.3.6",
|
||||||
|
"express": "=4.13.3",
|
||||||
"font-awesome": "=4.6.1",
|
"font-awesome": "=4.6.1",
|
||||||
"jquery": "=2.2.3",
|
"jquery": "=2.2.3",
|
||||||
"jquery.easing": "=1.3.2",
|
"jquery.easing": "=1.3.2",
|
||||||
|
|
37
scripts/server.js
Normal file
37
scripts/server.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
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);
|
||||||
|
});
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd output/
|
|
||||||
python3 -m pelican.server $PORT
|
|
Reference in a new issue