No description
Find a file
Daragh Downes 64c645732f
All checks were successful
/ check_lfs (push) Successful in 1s
Merge pull request 'include db to make it easier to run' (#113) from aaa into main
Reviewed-on: #113
2025-11-23 23:40:08 +00:00
.forgejo/workflows remove eslint 2025-11-23 08:23:56 +00:00
doc Initial commit 2025-11-20 16:19:41 +00:00
src include db to make it easier to run 2025-11-23 23:19:05 +00:00
.gitattributes Initial commit 2025-11-20 16:19:41 +00:00
.gitignore include db to make it easier to run 2025-11-23 23:19:05 +00:00
.mailmap Initial commit 2025-11-20 16:19:41 +00:00
LICENSE Initial commit 2025-11-20 16:19:41 +00:00
Makefile test: makefile and docs 2025-11-22 12:44:47 +00:00
README.md Update README.md 2025-11-23 23:35:54 +00:00

include_toc
true
Table of Contents

Project Setup

Building / Running / Testing

  • First time run needs to create .env file under src/ , nothing needs to be included the file is expected by the docker compose however
  • Run tests with make test ( git bash should have make, if not just see the command make is running )
  • Run the project with docker with make docker
  • Repo includes a demo database for ease of use
  • Commands below can be used if demo buttons aren't working

Class rep account credentials

Clear Elasticsearch index

docker exec csis_cms_backend python -c "from elasticsearch import Elasticsearch; es = Elasticsearch(['http://csis_cms_elasticsearch:9200']); es.indices.delete(index='posts', ignore=[404]); print('Index deleted')"

Clear database

docker exec csis_cms_backend python manage.py flush --no-input

Test users

These users are created manually and link up to the buttons on the login page, registration is assumed to be done with already exisiting UL accounts so theres no "registration",

Create admin user

docker exec -it csis_cms_backend python manage.py shell -c "from users.models import User; admin = User.objects.create(email='admin@ul.ie', first_name='Admin', last_name='User', role='admin'); admin.set_password('admin123'); admin.save(); print('Admin created: admin@ul.ie / admin123')"

Create staff user

docker exec -it csis_cms_backend python manage.py shell -c "from users.models import User; staff = User.objects.create(email='staff@ul.ie', first_name='Staff', last_name='User', role='staff'); staff.set_password('staff123'); staff.save(); print('Staff created: staff@ul.ie / staff123')"

Create student user

docker exec -it csis_cms_backend python manage.py shell -c "from users.models import User; student = User.objects.create(email='student@ul.ie', first_name='Student', last_name='User', role='student'); student.set_password('student123'); student.save(); print('Student created: student@ul.ie / student123')"

Generate test posts

docker exec csis_cms_backend python manage.py generate_test_posts --count 50

Restart worker to rebuild Elasticsearch index

docker restart csis_cms_worker

Commit Signing

Commit signing is worth a bonus mark so we should all have it setup,
Create an ssh key, for windows this will require git bash
ssh-keygen -t ed25519 -C "myemail@email.com"

Once this is created go to the generated file and open the .pub file and copy the contents
Go to this page - https://cs4297.skynet.ie/user/settings/keys
Click add key and paste in the copied key, give it a name
Once its addded it, click verify key and follow the instructions.

After that, clone the repository with the ssh url like so,
git clone ssh://cs4297@cs4297.skynet.ie:9001/2025/CSIS-CMS-Group-9.git
Once its cloned create a test branch to make sure your commits are signed,
git checkout -b test-sign-name
Edit a file such as readme just add a character or word to test, git add .
git commit -m "testing signed commits"
git push origin test-sign-name
Go to forgejo and check the commit history branch to see if it signed correctly, it will show a green padlock.

Project Base

This repo contains initial decent defaults for any new Skynet/Compsoc/Any) project.

Testing signing commit 1

Tools

Kanban

A basic Kanban can be found by going to the Projects tab.

CI/CD

A CI/CD runner is provided and can be found in the Actions tab.
This runner is Github actions compatible.

Components

Each file has a particular reason for existing, often learnt through (painful) experiences.

Not every file is required (such as .mailmap), but most are strongly recommended.

README.md

Every project should have a README/README.txt/README.md.
This allows ye to concisely state what the repo is about as well as any quickstart guide.
It is often done using Markdown (.md) since that allows for structured text and HTML compatability.

If the documentation gets too long it is advised to create a doc folder as outlined below.

LICENSE

The included LICENSE is the MIT one.
You can dual (multi) license by including LICENSE-MIT and LICENSE-APACHE as what is common in rust projects.

If a project does not have a license then it is source available, rights reserved.

.gitignore

This controls what git is permitted to commit and control.
The file helps ensure that you dont commit code artifacts such as compiled binaries.

It is also a solid defence against committing secrets.

.gitattributes

The .gitattributes file preforms two useful roles in this repo:

  1. Ensures a consistent line ending across Windows/Mac/Linux systems.
    • Line endings is useful in a multi device environment.
  2. Tells git which files to delegate to LFS.
    • Git is good with text based files.
    • Git-LFS is an addon which stores the files separately and commits a reference to them.
    • This helps ensure teh git repo is not bloated by binary (non text) files.

Git LFS installer: https://git-lfs.com/

.forgejo/workflows/check_lfs.yaml

This is a pipeline config which runs whenever a commit is pushed (push), a merge request is updated (pull_request) or manually requested (workflow_dispatch).

Its purpose is to verify that all files which should be in LFS are in LFS.

When more pipelines are added to a repo then it should be integrated into them.

Github compatability

The pipeline is compatible with Github, to do so you need to rename .forgejo to .github.

Directories

src

It is generally recommended that source code for the project goes into this folder.
This is an industry psudo-standard.

doc

In repo documentation should be put in a doc/docs/documentation folder.
Like src this is an industry psudo-standard.

If the documentation is in the src files this is less important.

Useful but less important

.mailmap

Git works based off of email signatures and a single person may have multiple emails associated with git.
This file maps multiple emails to a single person, or corrects errros in names.

Documentation: https://git-scm.com/docs/gitmailmap

.gitkeep

Git tracks files, to it a folder is just a path to a file.
Thus if a folder is empty then it is invisible to git.
If you wish to commit a folder (as with src and doc in this repo) then you need a placeholder file.
Once there are other files in the repo then the .gitkeep can be removed.

Updating

If any of the files in this repo are updated down the line, such as .gitignore/.gitattributes/.forgejo/workflows/check_lfs.yaml then it is recommended to backport the changes here.