Skip to content

Commit 7e84fc6

Browse files
committed
Started writing the main README file
1 parent 39a313f commit 7e84fc6

File tree

2 files changed

+188
-2
lines changed

2 files changed

+188
-2
lines changed

README.md

Lines changed: 188 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,188 @@
1-
# codegarten
2-
CodeGarten
1+
<div align="center" style="margin-bottom: 30px;">
2+
<div style="margin-bottom: 30px">
3+
<img src="./resources/graphics/logo-color.png" height="200px" alt="i-on CodeGarten logo" />
4+
</div>
5+
<div>
6+
<a href="/blob/main/LICENSE">
7+
<img src="https://img.shields.io/github/license/i-on-project/codegarten" />
8+
</a>
9+
<a href="/graphs/contributors">
10+
<img src="https://img.shields.io/github/contributors/i-on-project/codegarten" />
11+
</a>
12+
<a href="/stargazers">
13+
<img src="https://img.shields.io/github/stars/i-on-project/codegarten" />
14+
</a>
15+
<a href="/issues">
16+
<img src="https://img.shields.io/github/issues/i-on-project/codegarten" />
17+
</a>
18+
<a href="/pulls">
19+
<img src="https://img.shields.io/github/issues-pr/i-on-project/codegarten" />
20+
</a>
21+
</div>
22+
</div>
23+
24+
# Overview
25+
The i-on initiative seeks to build an extensible platform in order to support academic activities. The i-on CodeGarten project provides a system, for both students and teachers, that aims to help with the management of GitHub repositories, in an academic context.
26+
27+
# Table Of Contents
28+
- [Functionalities](#functionalities)
29+
- [Components](#components)
30+
- [Getting Started](#getting-started)
31+
- [Running the server application](#running-the-server-application)
32+
- [Creating a GitHub App](#creating-a-github-app)
33+
- [Setting up the secrets directory](#setting-up-the-secrets-directory)
34+
- [Cipher key](#cipher-key)
35+
- [GitHub App private key](#github-app-private-key)
36+
- [GitHub App properties JSON](#github-app-properties-json)
37+
- [Warning to Windows users](#warning-to-windows-users)
38+
- [Running with Docker](#running-with-docker)
39+
- [Building the server application](#building-the-server-application)
40+
- [Running without Docker](#running-without-docker)
41+
- [Running the web application](#running-the-web-application)
42+
- [Setting up the cipher key](#setting-up-the-cipher-key)
43+
- [Running with Docker](#running-with-docker)
44+
- [Building the web application](#building-the-server-application)
45+
- [Running without Docker](#running-without-docker)
46+
47+
# Functionalities
48+
i-on CodeGarten exposes the following functionalities:
49+
50+
- Authentication through a GitHub account
51+
- Listing of the user's GitHub Organizations
52+
- Classroom creation and listing in a GitHub Organization
53+
- Student and team management in a classroom
54+
- Assignment management in a classroom
55+
- Deliveries management in an assignment
56+
- Automatic creation of GitHub repositories by joining an assignment
57+
- Student delivery checking by teachers
58+
- Invite support for both classrooms and assignments
59+
60+
# Components
61+
The i-on CodeGarten system is composed by a server application and a web application, which serves as a client for the server app.
62+
63+
The i-on CodeGarten server application is an application that exposes an web API. All i-on CodeGarten clients (web, mobile...) communicate with this server application. It is also here where all the system logic is implemented and where the system information is stored. This application is also responsible for performing all communication with the web API provided by GitHub, through the use of a GitHub App.
64+
65+
The CodeGarten web application uses the API to expose its functionalities to the user in a friendly manner, acting as a client of the server application.
66+
67+
# Getting Started
68+
The following chapters document the requires procedures to run the i-on CodeGarten system.
69+
70+
## Running the server application
71+
There's different ways to run the server application, although both of them require the `secrets` directory to be set up (in the case of Docker, in `code/jvm`), as well as the creation of a GitHub App.
72+
73+
### Creating a GitHub App
74+
In order for the server application to be able to make requests to the GitHub API, it needs a GitHub App. To do so, follow the instructions detailed [here](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app). Then, set up these options accordingly:
75+
76+
- Callback URL: This should be set to the `/im/github/authorize/cb` path relative to the server app's domain (e.g. `http://localhost:8080/im/github/authorize/cb`)
77+
- Setup URL: This should be set to the `im/github/install/cb` path relative to the server app's domain (e.g. `http://localhost:8080/im/github/install/cb`)
78+
- Permissions: Please set the following permissions:
79+
- Repository Permissions
80+
- Administration (Read & Write)
81+
- Contents (Read & Write)
82+
- Metadata (Read-only)
83+
- Commit Statuses (Read-only)
84+
- Organization permissions
85+
- Members (Read & Write)
86+
- Administration (Read & Write)
87+
- Disable "User-to-server token expiration"
88+
89+
### Setting up the secrets directory
90+
The server application requires some secret information in order to be able to be executed (including running the tests). This information is composed by (the file names are the ones specified in the Dockerfile):
91+
92+
- `cipher-key.txt` - A cipher key that'll be used to cipher sensitive information in the database
93+
- `gh-app-private-key.pem` - The GitHub App's private key, in order to be able to sign JWTs
94+
- `github-app-properties.json` - A GitHub App Properties JSON that specifies information about the Github App
95+
96+
The path for these files can be specified through the use of the following environment variables, respectively:
97+
98+
- `CODEGARTEN_CIPHER_KEY_PATH`
99+
- `CODEGARTEN_GITHUB_APP_PRIVATE_KEY_PATH`
100+
- `CODEGARTEN_GITHUB_APP_PROPERTIES_PATH`
101+
102+
#### Cipher key
103+
The cipher key is specified in a simple text file. It will be padded or cut in order to have exactly 16, 24 or 32 bytes.
104+
105+
#### GitHub App private key
106+
The GitHub App's private key can be obtained from its configuration page. Since it auto-downloads a `.pem` file, it can be easily copied over to the `secrets` directory.
107+
108+
#### GitHub App properties JSON
109+
This file needs to follow the following scheme:
110+
```json
111+
{
112+
"name": "GitHub App Name",
113+
"id": 1234,
114+
"clientId": "The Client ID",
115+
"clientSecret": "The Client Secret"
116+
}
117+
```
118+
- name: The GitHub App's client name
119+
- id: The GitHub App's "App ID"
120+
- clientId: The GitHub App's "Client ID"
121+
- clientSecret: The GitHub App's "Client Secret"
122+
123+
This information can be obtained through the GitHub App's configuration page. The client secret can be obtained by generating one in that same page.
124+
125+
### Warning to Windows users
126+
Since Windows uses CRLF (carriage-return line-feed) line endings, there may be problems while trying to run and build the server application.
127+
128+
In order to fix these issues, the `Checkout as-is, commit Unix-style line endings` option must be enabled during the Git installation process. This guarantees that every file is converted to LF line endings once committed, and that checkouts don't result in line-ending conversions, keeping them as LF. In case of having Git already installed, the `core.autocrlf` configuration key can be changed as shown below:
129+
130+
```
131+
git config --global core.autocrlf input
132+
```
133+
134+
### Running with Docker
135+
136+
To run the i-on CodeGarten server app locally with Docker, both the Dockerfile and Docker Compose files present in the `code/jvm` directory can be used to start the database and the server app itself. That can be achieved through the execution of the following commands in the `code/jvm` directory:
137+
138+
```
139+
docker-compose -p codegarten up -d
140+
141+
gradlew extractUberJar -x test
142+
docker build -t codegarten-server .
143+
docker run -e "JDBC_DATABASE_URL=jdbc:postgresql://codegarten-db:5432/db?user=codegarten&password=changeit" -e PORT=8080 -p 8080:8080 --network=codegarten_default -t --name codegarten-server codegarten-server
144+
```
145+
146+
After running these commands, the server application should be available on port `8080` (can be changed through the `PORT` environment variable and port mapping option) and the database on port `5432`. The connection string for the database can also be changed, as seen in the `JDBC_DATABASE_URL` environment variable passed in the last command.
147+
148+
In order to access the API, an access token is required. More info about how to obtain one is available [here](/blob/main/docs/api/auth/README.md)
149+
150+
To clean up the application and database containers, the following commands can be executed in the `code/jvm` directory:
151+
152+
```
153+
docker rm -f codegarten-server
154+
docker-compose -p codegarten down
155+
```
156+
157+
### Building the server application
158+
The server application will connect to a PostgreSQL database specified with the `JDBC_DATABASE_URL` environment variable. The database URI can also be specified using `DATABASE_URL` environment variable, although it needs to be formatted as specified [here](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING). The test database also needs to be specified using the `CODEGARTEN_TEST_DB_CONNECTION_STRING` environment variable, as well as the [secret files and their paths](#setting-up-the-secrets-directory)
159+
160+
The execution of this command in the `code/jvm` directory will build the application.
161+
162+
```
163+
gradlew build
164+
```
165+
166+
The above command will attempt to start a test database using Docker on port `5433`. If that's not the desired behavior, the following command can be executed instead.
167+
168+
```
169+
gradlew build -x dbTestsWait -x dbTestsDown
170+
```
171+
172+
### Running without Docker
173+
The previous chapter explained how to build the server application. Running the server app requires the database to be specified using the environment variables stated [here](#building-the-server-application), as well as the [secret files and their paths](#setting-up-the-secrets-directory).
174+
175+
To run the built application, the following command can be executed in the `code/jvm` directory:
176+
```
177+
java -server -jar ./build/libs/codegarten-0.1.jar
178+
```
179+
180+
## Running the web application
181+
182+
### Setting up the cipher key
183+
184+
### Running with Docker
185+
186+
### Building the web application
187+
188+
### Running without Docker

resources/graphics/logo-color.png

24.3 KB
Loading

0 commit comments

Comments
 (0)