Skip to content

Codebase and assets used to create and manage my personal website

License

Notifications You must be signed in to change notification settings

ndjenkins85/personalsite

Repository files navigation

Personal site

This is the repo which generates my personal website. It uses docker for hosting on Heroku. The site is open to public, and intended for colleagues, friends, family and recruiters.

The site uses flask framework to serve markdown blog posts according to my custom scripts.

Instructions for users

Users interested in seeing the website can visit on heroku here.

Instructions for developers

The following are the setup instructions for developers looking to improve this project. For information on current contributors and guidelines see the contributors section. Follow each step here and ensure tests are working.

Dependency and virtual environment management, library development and build with poetry

Ensure you have and installation of Poetry 1.2.0a1 or above, along with poetry-version-plugin.

Make sure you deactivate any existing virtual environments (i.e. conda).

poetry install

You may need to point poetry to the correct python interpreter using the following command. In another terminal and in conda, run which python.

poetry env use /path/to/python3

Library can be built using

poetry build

Code quality, testing, and generating documentation with Nox

Nox is a python task automation tool similar to Tox, Makefiles or scripts.

The following command can be used to run mypy, lint, and tests. It is recommended to run these before pushing code, as this is run with Github Actions. Some checks such as black are run more frequently with pre-commit.

poetry run nox

Local Sphinx documentation can be generated with the following command. Documentation publishing using Github Actions to Github pages is enabled by default.

poetry run nox -s docs

All other task automations commands can be optionally run locally with below command.

poetry run nox -s black safety pytype typeguard coverage xdoctest autoflake

Code formatting with Pre-commit

On first time use of the repository, pre-commit will need to be installed locally. You can use the following command to install and run pre-commit over all files. See .pre-commit-config.yaml for checks in use. Intention is to have lightweight checks that automatically make code changes.

pre-commit run --all-files

Running the webserver

Local webserver

After following above instructions to use poetry environment, view website locally with following command:

python run.py
...
 * Serving Flask app 'personalsite' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Visit localhost on browser.

Containerized webserver

Webserver can be started using docker-compose or Dockerfile. The Heroku publishing via github actions uses Dockerfile.

docker-compose build
docker-compose up
docker-compose down

Alternatively run from Dockerfile:

docker build -t bluemania/personalsite .
docker run -p 5000:5000 -e PORT=5000 --rm bluemania/personalsite
docker stop $(docker ps -a -q)

Visit localhost on browser.

Publish to Heroku

The following commands are used to push the containerized webserver to Heroku. These steps currently need to be performed in local development environment.

heroku login
docker build -t bluemania/personalsite .
heroku container:login
docker tag bluemania/personalsite registry.heroku.com/nickjenkins/web
docker push registry.heroku.com/nickjenkins/web
heroku container:release web -a nickjenkins

Contributors

  • Nick Jenkins - Data Scientist, API & Web dev, Team lead, Writer

See CONTRIBUTING.md in Github repo for specific instructions on contributing to project.

Usage rights governed by LICENSE in Github repo or page footer.