Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cookietemple.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cookietemple_version: '0.1.0 # <<COOKIETEMPLE_NO_BUMP>>'
cookietemple_version: '1.2.4 # <<COOKIETEMPLE_NO_BUMP>>'
domain: web
language: python
project_slug: mlf_core_website
project_slug_no_hyphen: mlf_core_website
template_version: '1.0.0 # <<COOKIETEMPLE_NO_BUMP>>'
template_version: '1.1.0 # <<COOKIETEMPLE_NO_BUMP>>'
template_handle: web-website-python
github_username: mlf-core
creator_github_username: zethson
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assignees: ''

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when ... -->

**Describe the solution you'd like**
**Describe the solution you would like**

<!-- A clear and concise description of what you want to happen. -->

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build mlf_core_website Package

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/check_no_SNAPSHOT_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
# PRs to the repository master branch are only ok if coming from any patch or release branch
- name: Install cookietemple
run: pip install cookietemple
Expand All @@ -23,7 +27,6 @@ jobs:
exit 0
fi


# If the above check failed, post a comment on the PR explaining the failure
# NOTE - this may not work if the PR is coming from a fork, due to limitations in GitHub actions secrets
- name: Post PR comment
Expand All @@ -38,4 +41,3 @@ jobs:
The `master` branch should never have any SNAPSHOT versions, since only fully stable code should be on the `master` branch.
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false

Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ jobs:
cd docs
make html

- name: Deploy
if: ${{ github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html

5 changes: 4 additions & 1 deletion .github/workflows/run_bandit.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Run bandit

on:
on:
push:
paths:
- "**/*.py"
pull_request:
paths:
- "**/*.py"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Run Codecov
on: [push]
on: [push, pull_request]

jobs:
run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_cookietemple_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.9

- name: Install cookietemple
run: |
pip install cookietemple

- name: Run cookietemple lint
run: |
cookietemple lint .
cookietemple lint . --skip-external
5 changes: 4 additions & 1 deletion .github/workflows/run_css_lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: CSS linter

on:
on:
push:
paths:
- "**/*.css"
pull_request:
paths:
- "**/*.css"

jobs:
build:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/run_flake8_linting.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Run flake8 linting

on:
on:
push:
paths:
- "**/*.py"
pull_request:
paths:
- "**/*.py"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tox_testsuite.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Run mlf_core_website Tox Test Suite

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/sync_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: cookietemple sync

on:
schedule:
- cron: '0 1 * * *' # 1 am UTC
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install cookietemple
run: pip install cookietemple

- uses: actions/checkout@v2
with:
fetch-depth: 0
token: '${{ secrets.CT_SYNC_TOKEN }}'
name: Check out source-code repository

- uses: oleksiyrudenko/gha-git-credentials@v2
with:
name: 'zethson'
email: '[email protected]'
actor: 'zethson'
token: '${{ secrets.CT_SYNC_TOKEN}}'

- name: Sync project
run: cookietemple sync . ${{ secrets.CT_SYNC_TOKEN }} zethson
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020, Lukas Heumos
Copyright (c) 2021, Lukas Heumos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
90 changes: 5 additions & 85 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,85 +1,5 @@
.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
import os, webbrowser, sys

from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache

lint: ## check style with flake8
flake8 mlf_core_website tests

test: ## run tests quickly with the default Python
pytest

test-all: ## run tests on every Python version with tox
tox

coverage: ## check code coverage quickly with the default Python
coverage run --source mlf_core_website -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/mlf_core_website.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ mlf_core_website
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: dist ## package and upload a release
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
pip install .
ifeq ($(OS),Windows_NT)
include makefiles/Windows.mk
else
include makefiles/Linux.mk
endif
4 changes: 4 additions & 0 deletions cookietemple.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ current_version = 0.1.0

[bumpversion_files_whitelisted]
setup_file = setup.py
dot_cookietemple = .cookietemple.yml

[bumpversion_files_blacklisted]

[sync_level]
ct_sync_level = minor

[sync_files_blacklisted]
changelog = CHANGELOG.rst
requirements = requirements.txt
requirements_dev = requirements_dev.txt

31 changes: 19 additions & 12 deletions deployment_scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
#!/bin/bash
# Reference:
# https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-dev nginx -y
sudo pip3 install virtualenv

apt-get update
virtualenv dpenv
source dpenv/bin/activate

sudo apt-get update
pip3 install gunicorn

python3 setup.py clean --all install
make install

cp /home/cookietempleuser/mlf_core_website/deployment_scripts/mlf_core_website.service \
/etc/systemd/system/mlf_core_website.service

systemctl start mlf_core_website
sudo systemctl start mlf_core_website

systemctl enable mlf_core_website
sudo systemctl enable mlf_core_website

cp /home/cookietempleuser/mlf_core_website/deployment_scripts/mlf_core_website \
/etc/nginx/sites-available/mlf_core_website

ln -s /etc/nginx/sites-available/mlf_core_website /etc/nginx/sites-enabled

nginx -t
sudo nginx -t

systemctl restart nginx
sudo systemctl restart nginx

ufw delete allow 5000
sudo ufw delete allow 5000

ufw allow 'Nginx Full'
sudo ufw allow 'Nginx Full'

add-apt-repository ppa:certbot/certbot -y
sudo add-apt-repository ppa:certbot/certbot -y

apt install python3-certbot-nginx -y
sudo apt install python3-certbot-nginx -y

certbot --nginx -d mlf-core.com -d www.mlf-core.com --non-interactive --agree-tos -m [email protected]
sudo certbot --nginx -d mlf-core.com -d www.mlf-core.com --non-interactive --agree-tos -m [email protected]
Loading