Set up LMS-C as submodule with external content directory
parent
76e8769486
commit
632652914c
36
README.md
36
README.md
|
|
@ -59,13 +59,17 @@ A web-based learning management system for C programming with interactive exerci
|
||||||
|
|
||||||
2. Run the container:
|
2. Run the container:
|
||||||
```bash
|
```bash
|
||||||
podman run -p 5000:5000 -v $(pwd)/content:/app/content -v $(pwd)/static:/app/static -v $(pwd)/templates:/app/templates -v $(pwd)/tokens.csv:/app/tokens.csv lms-c
|
podman run -p 5000:5000 -v ../content:/app/content -v ./static:/app/static -v ./templates:/app/templates -v ./tokens.csv:/app/tokens.csv lms-c
|
||||||
```
|
```
|
||||||
|
|
||||||
## Content Structure
|
## Content Structure
|
||||||
|
|
||||||
The system uses Markdown files for content management. There are two main types of content files:
|
The system uses Markdown files for content management. There are two main types of content files:
|
||||||
|
|
||||||
|
### Content Directory Location
|
||||||
|
|
||||||
|
The content directory is located at the parent directory level, outside of the `elemes/` directory. This allows for easy linking and sharing of content between different instances of the LMS.
|
||||||
|
|
||||||
### Home Page (`home.md`)
|
### Home Page (`home.md`)
|
||||||
|
|
||||||
The home page serves as the main landing page and lesson directory. Here's the template structure:
|
The home page serves as the main landing page and lesson directory. Here's the template structure:
|
||||||
|
|
@ -329,7 +333,7 @@ int main() {
|
||||||
|
|
||||||
### Updating the Home Page
|
### Updating the Home Page
|
||||||
|
|
||||||
After creating new lessons, update the `content/home.md` file to include links to your new lessons in the `---Available_Lessons---` section:
|
After creating new lessons, update the `../content/home.md` file to include links to your new lessons in the `---Available_Lessons---` section:
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
---Available_Lessons---
|
---Available_Lessons---
|
||||||
|
|
@ -339,7 +343,7 @@ After creating new lessons, update the `content/home.md` file to include links t
|
||||||
|
|
||||||
### Content Organization
|
### Content Organization
|
||||||
|
|
||||||
- Store all lesson files in the `content/` directory
|
- Store all lesson files in the `../content/` directory (at the parent directory level)
|
||||||
- Use descriptive filenames with underscores instead of spaces (e.g., `variables_and_data_types.md`)
|
- Use descriptive filenames with underscores instead of spaces (e.g., `variables_and_data_types.md`)
|
||||||
- Keep lesson files focused on a single topic or concept
|
- Keep lesson files focused on a single topic or concept
|
||||||
- Use consistent formatting and structure across all lessons
|
- Use consistent formatting and structure across all lessons
|
||||||
|
|
@ -372,6 +376,30 @@ The CSV file format is: `token;nama_siswa;lesson1;lesson2;...`
|
||||||
6. View the output in the output panel
|
6. View the output in the output panel
|
||||||
7. For student tracking, use the token login field in the top navigation bar
|
7. For student tracking, use the token login field in the top navigation bar
|
||||||
|
|
||||||
|
## Using as a Submodule
|
||||||
|
|
||||||
|
This LMS can be used as a submodule in another repository. To set it up:
|
||||||
|
|
||||||
|
1. Add this repository as a submodule to your main project:
|
||||||
|
```bash
|
||||||
|
git submodule add <repository-url> elemes
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Create a content directory at the root level of your main project:
|
||||||
|
```bash
|
||||||
|
mkdir content
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Add your lesson files to the content directory
|
||||||
|
|
||||||
|
4. Run the LMS from the elemes directory:
|
||||||
|
```bash
|
||||||
|
cd elemes
|
||||||
|
podman-compose -f podman-compose.yml up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
The content directory at the root level will be automatically mounted to the application container.
|
||||||
|
|
||||||
## Security Considerations
|
## Security Considerations
|
||||||
|
|
||||||
- The application runs C code in a containerized environment
|
- The application runs C code in a containerized environment
|
||||||
|
|
@ -382,7 +410,7 @@ The CSV file format is: `token;nama_siswa;lesson1;lesson2;...`
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
- `app.py`: Main Flask application
|
- `app.py`: Main Flask application
|
||||||
- `content/`: Directory for lesson Markdown files
|
- `../content/`: Directory for lesson Markdown files (at parent directory level)
|
||||||
- `templates/`: HTML templates
|
- `templates/`: HTML templates
|
||||||
- `static/`: CSS, JavaScript, and other static assets
|
- `static/`: CSS, JavaScript, and other static assets
|
||||||
- `tokens.csv`: Student progress tracking file
|
- `tokens.csv`: Student progress tracking file
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ else
|
||||||
podman exec -it lms-c-container /bin/bash
|
podman exec -it lms-c-container /bin/bash
|
||||||
else
|
else
|
||||||
echo "Building and starting container..."
|
echo "Building and starting container..."
|
||||||
podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container lms-c
|
podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container -v ../content:/app/content -v ./static:/app/static -v ./templates:/app/templates -v ./tokens.csv:/app/tokens.csv lms-c
|
||||||
sleep 5 # Wait for the application to start
|
sleep 5 # Wait for the application to start
|
||||||
podman exec -it lms-c-container /bin/bash
|
podman exec -it lms-c-container /bin/bash
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
2
app.py
2
app.py
|
|
@ -17,7 +17,7 @@ from datetime import datetime
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
CONTENT_DIR = 'content'
|
CONTENT_DIR = '../content'
|
||||||
STATIC_DIR = 'static'
|
STATIC_DIR = 'static'
|
||||||
TEMPLATES_DIR = 'templates'
|
TEMPLATES_DIR = 'templates'
|
||||||
TOKENS_FILE = 'tokens.csv'
|
TOKENS_FILE = 'tokens.csv'
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import glob
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
CONTENT_DIR = 'content'
|
CONTENT_DIR = '../content'
|
||||||
TOKENS_FILE = 'tokens.csv'
|
TOKENS_FILE = 'tokens.csv'
|
||||||
|
|
||||||
def get_lesson_names():
|
def get_lesson_names():
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./content:/app/content
|
- ../content:/app/content
|
||||||
- ./static:/app/static
|
- ./static:/app/static
|
||||||
- ./templates:/app/templates
|
- ./templates:/app/templates
|
||||||
- ./tokens.csv:/app/tokens.csv
|
- ./tokens.csv:/app/tokens.csv
|
||||||
|
|
|
||||||
2
start.sh
2
start.sh
|
|
@ -17,7 +17,7 @@ if [ "$(podman ps -aq -f name=lms-c-container)" ]; then
|
||||||
else
|
else
|
||||||
# Build and run the container
|
# Build and run the container
|
||||||
echo "Building and starting container..."
|
echo "Building and starting container..."
|
||||||
podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container lms-c
|
podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container -v ../content:/app/content -v ./static:/app/static -v ./templates:/app/templates -v ./tokens.csv:/app/tokens.csv lms-c
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Application is now running. Access at http://localhost:5000"
|
echo "Application is now running. Access at http://localhost:5000"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue