Skip to content

Commit 034d662

Browse files
authored
feat: Create initial version (#1)
1 parent da2fc67 commit 034d662

29 files changed

+3663
-2
lines changed

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Python 3",
3+
"image": "mcr.microsoft.com/vscode/devcontainers/python:3.13",
4+
"forwardPorts": [8000],
5+
"postCreateCommand": "bash ./.devcontainer/postCreate.sh",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"GitHub.copilot",
10+
"ms-python.python",
11+
"ms-python.debugpy",
12+
"mongodb.mongodb-vscode"
13+
]
14+
}
15+
}
16+
}

.devcontainer/installMongoDB.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Install MongoDB
4+
wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -
5+
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
6+
sudo apt-get update
7+
sudo apt-get install -y mongodb-org
8+
9+
# Create necessary directories and set permissions
10+
sudo mkdir -p /data/db
11+
sudo chown -R mongodb:mongodb /data/db
12+
13+
# Start MongoDB service
14+
sudo mongod --fork --logpath /var/log/mongodb/mongod.log
15+
16+
echo "MongoDB has been installed and started successfully!"
17+
mongod --version
18+
19+
# Run sample MongoDB commands
20+
echo "Current databases:"
21+
mongosh --eval "db.getMongo().getDBNames()"

.devcontainer/postCreate.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Prepare python environment
2+
pip install -r requirements.txt
3+
4+
# Prepare MongoDB Dev DB
5+
./.devcontainer/installMongoDB.sh

.github/steps/1-protect-your-code.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Step 1: Protect your code
2+
3+
It's been a busy month at Mergington High! Your simple website for managing extra-curricular activities has really taken off. What started as a basic sign-up form for a few activities has grown into the go-to place for half the school activities. 📚✨
4+
5+
Principal Martinez was so impressed with your work that they announced at the last staff meeting that ALL clubs should start using the website. While this is exciting, you're a bit nervous - the last thing you want is an accidental change breaking the system right before the big Fall Activities Fair! 😰
6+
7+
When more teachers start helping with the Mergington High activities website, it's important to add some safeguards. Thankfully, GitHub provides several ways to protect your repository:
8+
9+
1. **Repository Rulesets** - These provide safeguards to limit:
10+
11+
- Pushing code directly to important branches
12+
- Deleting or renaming branches
13+
- Force pushing (which can overwrite history)
14+
- (and much more)
15+
16+
1. **`.gitignore`** - This special file tells Git which files it should NOT track, like:
17+
18+
- Temporary files that your code creates while running
19+
- Secret configuration files with sensitive information
20+
- System files that other developers don't need
21+
22+
> [!TIP]
23+
> Think of these settings like the editorial process of a school yearbook. Various student committees will take photos and write articles, then the yearbook president will make adjustments to make sure everything flows together properly. Finally, a teacher/advisor will sign off that all content is appropriate.
24+
25+
## ⌨️ Activity: Add a branch ruleset
26+
27+
Now let's add some protections so that no one accidentally breaks the club registration system:
28+
29+
1. In the top navigation, select the **Settings** tab.
30+
31+
1. In the left navigation, expand the **Rules** area and select **Rulesets**.
32+
33+
1. Click the **New ruleset** dropdown and select **New branch ruleset**.
34+
35+
<img width="250" alt="image" src="https://github.com/user-attachments/assets/1e9fd519-1421-4d6b-b654-a3fe53a8fb75" />
36+
37+
1. Set the **Ruleset Name** as `Protect main` and change the **Enforcement status** to `Active`.
38+
39+
<img width="250" alt="image" src="https://github.com/user-attachments/assets/ce30fd34-39b5-4e22-b348-4af61fd05cd1" />
40+
41+
1. Locate the the **Targets** section. Use the **Add target** dropdown to add 2 entries:
42+
43+
1. Add the **Include default branch** option to ensure protections aren't bypassed by switching the default branch.
44+
45+
<img width="250" alt="image" src="https://github.com/user-attachments/assets/217263cc-d5c2-4ac0-b03c-a72494e5c812" />
46+
47+
1. Use the **include by pattern** option and enter the pattern `main`.
48+
49+
<img width="250" alt="image" src="https://github.com/user-attachments/assets/47a835de-62dc-4f34-96d8-c2562f03af1a" />
50+
51+
<img width="250" alt="image" src="https://github.com/user-attachments/assets/ddc52767-d93e-4c9e-a77a-90c3b5c08fb5" />
52+
53+
1. Locate the **Rules** section. Ensure the following items are checked.
54+
- [x] Restrict deletions
55+
- [x] Require a pull request before merging
56+
- Required approvals: `1`
57+
- [x] Require review from Code Owners (explained in next step)
58+
- [x] Require status checks to pass before merging
59+
60+
## ⌨️ Activity: Create a `.gitignore` file
61+
62+
Let's start by making sure we don't accidentally commit files:
63+
64+
1. If necessary, open another tab and navigate to this repository. We will start on the **Code** tab.
65+
66+
1. Above the list of files, select the **branch dropdown menu**.
67+
68+
1. Create a new branch with the name `prepare-to-collaborate`.
69+
70+
<img width="300" alt="image" src="https://github.com/user-attachments/assets/1c04a3e4-e492-4857-9527-2b43908a1da1"/>
71+
72+
1. Above the list of files, click the **Add file** dropdown and select **Create new file**.
73+
74+
<img width="300" alt="New file button" src="https://github.com/user-attachments/assets/8f3f8da8-1471-485a-9df5-8c03ecba2d8e"/>
75+
76+
1. Enter the file name `.gitignore` and copy following example content into it.
77+
78+
<img width="350" alt="preview of new file" src="https://github.com/user-attachments/assets/580d1a63-a264-4d44-8901-50ad708b8822"/>
79+
80+
```gitignore
81+
# Python backend for club management
82+
__pycache__/
83+
*.py[cod] # Python compiled files
84+
*$py.class
85+
*.so
86+
.Python
87+
env/
88+
.env # Where database passwords are stored
89+
venv/ # Virtual environment for testing
90+
.venv
91+
92+
# Teacher IDE settings
93+
.vscode/ # Ms. Rodriguez uses VS Code
94+
.idea/ # Mr. Chen uses PyCharm
95+
96+
# Local development & testing
97+
instance/
98+
.pytest_cache/
99+
.coverage # Test coverage reports
100+
htmlcov/
101+
102+
# Staff computer files
103+
.DS_Store # For teachers with Macs
104+
Thumbs.db # For teachers with Windows
105+
```
106+
107+
1. In the top right, select the **Commit changes...** button. Notice that it won't let us commit to the `main` branch! Nice!
108+
109+
<img width="400" alt="image" src="https://github.com/user-attachments/assets/4e85948d-75c8-4c13-8ddd-4707bf9b0805" />
110+
111+
1. Enter `prepare-to-collaborate` for the branch name then click the **Propose changes** button.
112+
113+
1. With the file committed, wait a moment for Mona to check your work, provide feedback, and share the next lesson.
114+
115+
> [!TIP]
116+
> GitHub and the community have built up a repository with [sample `.gitignore` files](https://github.com/github/gitignore) for many situations. Make sure to check it out!
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Step 2: Prepare to collaborate
2+
3+
Your simple school website has become quite popular! After showing it at the last staff meeting, Ms. Rodriguez from the Art Club and Mr. Chen from the Chess Club came up to you super excited. They have tons of ideas for new features!
4+
5+
- Ms. Rodriguez wants to add a photo gallery
6+
- Mr. Chen dreams of adding a tournament bracket system for the chess/sports activities! 🎨♟️
7+
8+
While you're thrilled about their enthusiasm, you realize you need to set up some guidelines before letting them start changing code. The last thing you want is conflicting changes breaking the registration system right before spring break!
9+
10+
Opening your project to other teachers at Mergington High means thinking about how everyone will work together without breaking each other's code. To help with collaboration, GitHub provides two special files:
11+
12+
1. `CONTRIBUTING.md` - A "How to Help" guide. Some example content:
13+
14+
- How to prepare a developer setup of the extra-curricular activities website.
15+
- The process for suggesting changes.
16+
- The project's coding style preference, to keep things consistent.
17+
- How to ask for help when stuck.
18+
19+
2. `CODEOWNERS` - Assign specific people or teams responsible for a portion of the project.
20+
21+
- When someone creates a pull request, GitHub will automatically ask the right person to review it.
22+
23+
3. **Collaborators** - Give other people access to the project.
24+
25+
- Provide other people permissions to change project files while still protecting repository settings.
26+
- Personal repositories have simple permissions. Organization repositories allow flexible permissions such as read, write, maintain, and admin.
27+
28+
## ⌨️ Activity: Create a welcoming contribution guide
29+
30+
The IT Club meeting is tomorrow, and you need to prepare for Ms. Rodriguez and Mr. Chen to join the project. Let's start a document to help them contribute effectively.
31+
32+
1. Ensure you you are on the `prepare-to-collaborate` branch at the root directory.
33+
34+
1. In the top directory, create a new file called `CONTRIBUTING.md`.
35+
36+
1. Add a welcoming message.
37+
38+
```md
39+
# Contributing to the Mergington High Extra-Curricular Activities Website
40+
41+
Thank you for your interest in helping improve our school's website! Whether you want to add your club's activities, fix a bug, or suggest new features, this guide will help you get started. 🎉
42+
```
43+
44+
1. Add instructions to help them quickly start developing.
45+
46+
```md
47+
## Development Setup
48+
49+
1. Clone the repository to your computer.
50+
2. Install Python requirements: `pip install -r requirements.txt`.
51+
3. Run the development server: `python src/app.py`.
52+
4. Visit http://localhost:8000 in your browser to see the website.
53+
54+
## Making Changes
55+
56+
1. Create a new branch for your changes.
57+
- Use descriptive names like `art-gallery-feature` or `fix-chess-signup`
58+
2. Make your changes and test them locally with sample student data.
59+
- Use the MongoDB extension to preview the included sample date.
60+
3. Push your branch and create a pull request.
61+
4. Wait for review and address any feedback.
62+
63+
## Code Style
64+
65+
- Follow PEP 8 for Python code (backend).
66+
- Use clear, descriptive variable names (student_name, start_time, etc.)
67+
- Add comments to describe blocks of logic.
68+
```
69+
70+
1. Add a section for getting help.
71+
72+
```md
73+
## Need help or have ideas?
74+
75+
- Check the open issues first.
76+
- If your problem is there, add a comment or up-vote.
77+
- If not there, create a new issue. Be as descriptive as possible.
78+
- Ask in our weekly IT Club office hours (Thursdays at lunch in Room 203).
79+
- For other general problems, email the tech team at techclub@mergingtonhigh.example.edu
80+
```
81+
82+
1. In the top right, use the **Commit changes...** button to save your changes.
83+
84+
## ⌨️ Activity: Assign code ownership
85+
86+
With others joining the fun, you want to stay involved on anything affecting architecture and core functionality. Let's assign you to the related files.
87+
88+
1. Ensure you you are on the `prepare-to-collaborate` branch at the root directory.
89+
90+
1. Above the list of files, click the **Add file** dropdown and select **Create new file**.
91+
92+
<img width="300" alt="New file button" src="https://github.com/user-attachments/assets/8f3f8da8-1471-485a-9df5-8c03ecba2d8e"/>
93+
94+
1. Set the file name as `CODEOWNERS`, without an file extension.
95+
96+
1. Add the following content:
97+
98+
```codeowners
99+
# Core functionality - changes here should be rare!
100+
/src/app.py @{{ login }}
101+
/src/backend/database.py @{{ login }}
102+
/src/backend/routers/auth.py @{{ login }}
103+
104+
# The frontend will need refactored soon to be more object oriented.
105+
/src/static/ @{{ login }}
106+
```
107+
108+
1. In the top right, use the **Commit changes...** button to save your changes.
109+
110+
1. With the files committed, wait a moment for Mona to check your work, provide feedback, and share the next lesson.
111+
112+
## ⌨️ Activity: (Optional) Add your first collaborator
113+
114+
Ready to let your colleague start working on that photo gallery feature? Let's do it!
115+
116+
> [!IMPORTANT]
117+
> This step is optional because it requires another person with a GitHub account to participate.
118+
119+
1. In the top navigation, select the **Settings** tab.
120+
121+
1. In the left navigation, select **Collaborators**.
122+
123+
1. Find the **Manage access** area and click the **Add people** button.
124+
125+
<img width="350" alt="" src="https://github.com/user-attachments/assets/b1675ad5-57b1-441e-ab7a-22d26dccf6ce" />
126+
127+
1. Enter a friend/colleague's GitHub username or email then press the **Add to repository** button.
128+
129+
<img width="350" alt="" src="https://github.com/user-attachments/assets/caf1a193-c9db-4962-b01e-66666ef54369" />
130+
131+
> [!IMPORTANT]
132+
> Personal repositories only have one collaboration role type. A "collaborator" receives **write** permissions but NOT **admin** permissions.

0 commit comments

Comments
 (0)