Skip to content

andprov/fix_time

Repository files navigation

FixTime

License MIT Code style black Python versions Django versions Nginx version Postgres version

"Fix time" - A time tracker that allows monitoring the time spent on tasks.

Features

Time control dashboard

Project control project

Report report

Installation

Running the project locally

Clone a repository:

git clone git clone <https or SSH URL>

Go to the project directory:

cd fix_time

Create .env file:

touch .env

Template for .env file:

# Django settings
DEBUG=True
SECRET_KEY=<django_secret_key>
ALLOWED_HOSTS=127.0.0.1;localhost;<example.com;xxx.xxx.xxx.xxx>

# DB
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=fixtime
DB_HOST=db
DB_PORT=5432

# Superuser
ADMIN_USERNAME=admin
ADMIN_EMAIL=admin@admin.com
ADMIN_PASSWORD=admin

Deploy the application:

docker compose -f docker-compose.dev.yml up -d

Running a project on a remote server

To deploy to a remote server, you need to clone the repository to a local machine. Prepare and upload images to the Docker Pub.

Clone a repository:

git clone git clone <https or SSH URL>

Go to the project directory:

cd fix_time

Create .env file:

touch .env

Template for .env file:

# Django settings
DEBUG=False
SECRET_KEY=<django_secret_key>
ALLOWED_HOSTS=127.0.0.1;localhost;<example.com;xxx.xxx.xxx.xxx>

# SMTP
EMAIL_HOST=<smtp.example.com>
EMAIL_PORT=<port>
EMAIL_HOST_USER=<username>
EMAIL_HOST_PASSWORD=<password>

# DB
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=fixtime
DB_HOST=db
DB_PORT=5432

# Docker images
BACKEND_IMAGE=<username>/tracker_back
GATEWAY_IMAGE=<username>/tracker_gateway

# Superuser
ADMIN_USERNAME=admin
ADMIN_EMAIL=admin@admin.com
ADMIN_PASSWORD=admin

Create docker images images:

sudo docker build -t <username>/tracker_back tracker/
sudo docker build -t <username>/tracker_gateway gateway/

Upload images to Docker Hub:

sudo docker push <username>/tracker_back
sudo docker push <username>/tracker_gateway

Copy the .env and docker-compose.prod.yml files to a remote server:

scp .env docker-compose.prod.yml <username>@<server_address>:/home/<username>/<app_name>

Deploy the application on the server:

sudo docker compose -f docker-compose.prod.yml up -d