Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.
/ Bugtracker Public archive

Django powered bugtracker. Designing it to be minimal.

Notifications You must be signed in to change notification settings

shepherd-06/Bugtracker

Repository files navigation

Bugtracker - v0.0.1 - pre-alpha

How Bugtracker works

Step 1: Install postgresql on your server. By default: this will ensure your data integrity from my part. Then create a database and user for this app. Give the user permission on the newly created database. User will need connect, select, insert, update and delete permissions on the database. However, if you are feeling lazy, you may grant all privileges on all tables in the schema, although I don't recommend this. Finally, above all else, please don't use root user or grant the new user supseruser permissions. How to install postgresql database on ubuntu server Click here and here and here!

Step 2: Clone the repository from github. Create a virtualenv for bugtracker, install all the dependencies from requirements.txt file.

pip install -r requirements.txt

This part is really important, Bugtracker won't work unless you fully install every requirements.

Step 3: create a new .env file using your favorite editor on the project root directory.

  vim .env

Fill up the following entry on your .env file. DB_NAME, DB_USER, DB_PASSWORD, DB_URL, DB_PORT, SECRET_KEY.

SECRET_KEY could be anything as trivial as 123456 to UUID! I hope you are not using 123456 though.

Step 4: Now the moment of truth. I hope everything is all set and done. We are going to run migration.

python3 manage.py migrate

If it fails, please open up an issue on the github repository.

Step 5: We would need to manage the static files as well.

python3 manage.py collectstatic

This will open up a new directory and store all the static files in it. It's already supposed to be there with the repository, however, running this command won't kill anyone!

Step 6: Now we run this project. I hope you are going to run this project through nginx.

nohup python3 manage.py runserver 0.0.0.0:8000 &

This will start the app in background on port 8000. You can change it to anything else! Logs of command will be stored in .nohup.out file.

Step 7: You can use your webserver (nginx or apache) to forward to traffic to the server. There will be three entries for this. One will direct the traffic to port 8000 (or your defined port), the next will direct the traffic to static files and the another one for Django's admin portal. Nginx example:

  location / {
        rewrite ^/route/?(.*)$ /$1 break;
        proxy_pass  http://0.0.0.0:8000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout 60s;
    }

    location /static/ {
            alias /home/username/project_root_directory/static_bugtracker/;
    }

    location admin/ {
            rewrite ^/route/?(.*)$ /$1 break;
            proxy_pass  http://0.0.0.0:8000/admin/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_read_timeout 60s;
    }

Step 8: Restart nginx server to take the effect.

sudo service nginx restart

That's it! This should keep app running on your server, go ahead and check it out from your browser!