diff --git a/.buildpacks b/.buildpacks deleted file mode 100644 index 9b12f2c..0000000 --- a/.buildpacks +++ /dev/null @@ -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 diff --git a/.gitignore b/.gitignore index 1687001..0e1697c 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ theme/static/build/ pelican_plugins/ theme/static/src/scss/pygment.css +deploy/ diff --git a/Makefile b/Makefile index a508387..8c79214 100644 --- a/Makefile +++ b/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 diff --git a/Procfile b/Procfile deleted file mode 100644 index 063b78f..0000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: npm start diff --git a/etc/environments/development/procfile b/etc/environments/development/procfile index 063b78f..765d951 100644 --- a/etc/environments/development/procfile +++ b/etc/environments/development/procfile @@ -1 +1 @@ -web: npm start +web: bash scripts/server.sh diff --git a/package.json b/package.json index d32806e..c48be1e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index 78082e3..0000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.5.1 diff --git a/scripts/server.js b/scripts/server.js deleted file mode 100644 index e4c3588..0000000 --- a/scripts/server.js +++ /dev/null @@ -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); -}); diff --git a/scripts/server.sh b/scripts/server.sh new file mode 100644 index 0000000..f09ca56 --- /dev/null +++ b/scripts/server.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd output/ +python3 -m pelican.server $PORT