Skip to content

FabianVolkers/homepage

Repository files navigation

Portfolio Page

Contents

Description

This project started as my personal portfolio page but has become so dynamically configurable, it could be used for any website. My instance of this software is running live at fabianvolkers.com. It features an overview of the projects I've worked on as well as detail views for each project. Additionally, it features a selection of my photographs. There is a contact form for enquiries.

Features

  • Dynamically add pages with as many sections as you want
  • Add links to other platforms you're active on
  • Dynamically add collections with unlimited items
  • Contact form with connection to smtp server
  • Required email confirmation to avoid spam

Technologies

This web app is built with Python and Django. Django was chosen for it's powerful and secure ORM, built-in DB migrations and admin page for managing the database. The application is connected to a Postgres database. Media and static content is served by Nginx.

Diagram of request and response flows within the architecture

Deployment

The app is running live at fabianvolkers.com. The Django app is running as a service inside a Docker Swarm, in a stack with a postgres database container and an nginx container for serving media and static files. On top of that, load balancing and proxying is handled by a Traefik instance inside the Swarm.

Diagram of the Docker stack

Branches

The repository is mainly split into a 'latest' branch and a 'develop' branch. Every push to latest triggers a rebuild of the Docker image on Docker Hub. Once the build succeeds, the service powering fabianvolkers.com is automatically updated with the latest image. The plan for develop is similar, to then run at beta.fabianvolkers.com. Development workflow is close to the Git Flow model, with feature branches branched of developed and merged upon completion. Every once in a while develop gets merged with latest to keep the main release branch up to date.

Run the App

Docker-Compose

Pull Docker Hub image

The easiest way to run the app is to take the included docker-compose.yml file and run docker-compose up. This will start 3 services.

  1. Django App
  2. Postgres DB
  3. Nginx media and static server

All services will be pulled from docker hub.

# Create a directory and download the docker-compose file
mkdir homepage && cd homepage
wget https://raw.githubusercontent.com/FabianVolkers/portfolio/latest/docker-compose.yml

# Create a directory for the nginx config and download it
mkdir -p docker/nginx && cd docker/nginx
wget https://raw.githubusercontent.com/FabianVolkers/portfolio/latest/docker/nginx/nginx.conf

## return to the project root and start the containers
cd ../../
docker-compose up -d

Build docker image locally

Alternatively you can uncomment the build tag and comment out the image tag, to build the container yourself. This will naturally only work if you have cloned this repository.

Docker

This is currently not working due to default settings, use the docker-compose method to try out the software. If you just want to check out the django app without worrying about postgres or nginx, you can just use the following command to get started. This will use a small sample sqlite db.

docker run --publish 8000:8000 --detach --name homepage fabiserv/homepage:latest

Run directly on host machine

Alternatively you can clone the repo and use Django's manage.py runserver command.

# Clone the repository
git clone https://github.com/FabianVolkers/portfolio.git
cd portfolio

# Create and activate the virtual environment, install requirements
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Copy the example.env file into a .env file. Don't forget to replace the values with your own.
cp example.env .env

# Change into the project directory, initialise the database and run the server
cd homepage
python manage.py makemigrations portfolio
python manage.py migrate
python manage.py runserver