Skip to content

Commit 59bfa8b

Browse files
Merge pull request #153 from sheepdestroyer/docs-complete-repository-documentation
Docs complete repository documentation
2 parents 72d6e3e + b0a0233 commit 59bfa8b

File tree

6 files changed

+288
-151
lines changed

6 files changed

+288
-151
lines changed

README.md

Lines changed: 56 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -4,107 +4,92 @@ A simple, self-hosted RSS/Atom feed aggregator inspired by Netvibes & iGoogle, d
44

55
## Features
66

7-
* Organize grids of feeds into customizable tabs, like Netvibes / iGoogle
8-
* Import/Export tabs and feeds as OPML files (tested with exports from Netvibes).
9-
* Add feeds via URL.
10-
* Delete feeds.
11-
* Create, rename, and delete tabs.
12-
* Automatic background fetching of feed updates.
13-
* Real-time UI updates when feeds are refreshed in the background, powered by Server-Sent Events (SSE).
14-
* Mark items as read.
15-
* Displays unread counts per feed and per tab.
16-
* Basic persistence using a database.
7+
* **Feed Management**: Add, delete, and edit RSS/Atom feeds.
8+
* **Tabbed Organization**: Organize feeds into customizable tabs, similar to Netvibes and iGoogle.
9+
* **OPML Support**: Import and export your feeds and tabs as OPML files.
10+
* **Background Updates**: Automatically fetches feed updates in the background.
11+
* **Real-Time UI**: The user interface updates in real-time when feeds are refreshed, thanks to Server-Sent Events (SSE).
12+
* **Unread Tracking**: Mark items as read and see unread counts for each feed and tab.
13+
* **Persistence**: Your data is saved in a persistent database.
14+
15+
## Project Structure
16+
17+
* `.github/workflows/`: Contains GitHub Actions workflows for automated testing.
18+
* `backend/`: The Python Flask backend.
19+
* `app.py`: The main Flask application file, containing API endpoints and application logic.
20+
* `feed_service.py`: Handles fetching, parsing, and processing of RSS/Atom feeds.
21+
* `models.py`: Defines the database schema using SQLAlchemy.
22+
* `test_app.py`, `test_feed.py`: Pytest tests for the backend.
23+
* `frontend/`: The vanilla JavaScript frontend.
24+
* `index.html`: The main HTML file.
25+
* `script.js`: The main JavaScript file, containing all frontend logic.
26+
* `style.css`: The stylesheet for the application.
27+
* `pod/`: Contains files for deploying the application with Podman.
28+
* `quadlet/`: Contains Quadlet files for managing the application with systemd.
29+
* `scripts/`: Contains helper scripts for deployment and development.
1730

1831
## Production Deployment (Podman Pod with systemd using Quadlet)
1932

2033
This section describes how to deploy SheepVibes using a Podman Pod managed by systemd user services, leveraging Quadlet for easier unit file management.
2134

2235
### Prerequisites
2336

24-
- `podman` and `curl` installed (the deployment script will check for these).
25-
- Git (optional, if you prefer to clone the repository).
26-
- A modern version of Podman that includes Quadlet support.
37+
* `podman` and `curl` installed.
38+
* A modern version of Podman that includes Quadlet support.
39+
* Git (optional, if you prefer to clone the repository).
2740

2841
### Setup Instructions
2942

3043
1. **Obtain the Deployment Script**:
31-
32-
For the stable version, always refer to the `main` branch:
3344
```bash
34-
# Stable version from main:
3545
curl -O https://raw.githubusercontent.com/sheepdestroyer/sheepvibes/main/scripts/deploy_pod.sh
3646
```
3747

3848
2. **Make the Script Executable and Run It**:
39-
Navigate to where you downloaded the script (or the repository root if cloned).
40-
The script will fetch the necessary Quadlet unit files (e.g., `sheepvibespod.pod`, `sheepvibes-app.container`, `sheepvibes-db.volume`, etc.) from the `pod/quadlet/` directory in the GitHub repository (from the `main` branch, unless modified) and copy them to `~/.config/containers/systemd/`. Volume management is defined within these Quadlet files.
41-
49+
The script will download the necessary Quadlet files to `~/.config/containers/systemd/`.
4250
```bash
43-
chmod +x deploy_pod.sh # Or scripts/deploy_pod.sh if cloned
44-
./deploy_pod.sh # Or scripts/deploy_pod.sh if cloned
51+
chmod +x deploy_pod.sh
52+
./deploy_pod.sh
4553
```
46-
The script will check for dependencies, guide you through the process, and inform you of the next steps.
4754

4855
3. **Manage the Service**:
4956
After running the deployment script, you will be instructed to:
50-
- Reload systemd to recognize the new Quadlet files and generate systemd services:
57+
- Reload systemd to recognize the new Quadlet files:
5158
```bash
5259
systemctl --user daemon-reload
5360
```
54-
- Start the main pod service (which in turn starts all containers and creates volumes):
61+
- Start the main pod service:
5562
```bash
5663
systemctl --user start sheepvibespod-pod.service
5764
```
58-
- Check the status of the pod and its components:
65+
- Check the status of the pod:
5966
```bash
6067
systemctl --user status sheepvibespod-pod.service
61-
systemctl --user status sheepvibes-app.service
62-
systemctl --user status sheepvibes-redis.service
63-
# You can also check the status of volume services (they are Type=oneshot)
64-
systemctl --user status sheepvibes-db-volume.service
65-
systemctl --user status sheepvibes-redis-data-volume.service
6668
```
67-
- View logs for the entire pod (follow):
69+
- View logs for the entire pod:
6870
```bash
6971
journalctl --user -u sheepvibespod-pod.service -f
7072
```
71-
- View logs for a specific container (e.g., `sheepvibes-app`):
72-
```bash
73-
journalctl --user -u sheepvibespod-pod.service -t sheepvibes-app
74-
# Or for more detailed logs of just the app container's service:
75-
journalctl --user -u sheepvibes-app.service -f
76-
```
77-
The `sheepvibes-redis` container runs within the same pod and is managed as part of `sheepvibespod-pod.service`. Network communication between the app and Redis occurs over `localhost` within the pod. Application data and Redis data are stored in Podman-managed volumes (e.g., `systemd-sheepvibes-db` and `systemd-sheepvibes-redis-data` by default), defined via `.volume` Quadlet files.
7873

7974
4. **Enable Auto-start (Optional)**:
80-
The `pod/quadlet/sheepvibespod.pod` file includes an `[Install]` section with `WantedBy=default.target`. This means that after you run `systemctl --user daemon-reload` (as instructed by the `deploy_pod.sh` script), the main pod service (`sheepvibespod-pod.service`) is automatically configured to start when your user session begins.
81-
82-
No separate `systemctl --user enable sheepvibespod-pod.service` command is needed, and attempting to run it on the generated service will result in an error.
83-
84-
To verify auto-start, you can log out and log back in. The service should start automatically.
85-
86-
*Note on system boot*: For user services to start automatically when the system boots (i.e., without requiring an interactive login for that user), you may need to enable lingering for your user. This typically requires root privileges:
75+
The `pod/quadlet/sheepvibespod.pod` file includes an `[Install]` section that enables the service to start automatically with your user session. For the service to start at boot (without requiring a login), you may need to enable lingering for your user:
8776
```bash
8877
sudo loginctl enable-linger $(whoami)
8978
```
9079

9180
### Accessing the Application
9281

93-
Once started, the application will be accessible at `http://127.0.0.1:5000` by default. This is configured by the `PublishPort` setting in the `[Pod]` section of the `pod/quadlet/sheepvibespod.pod` file. If you need to access it from other machines, you might need to:
94-
1. Adjust firewall settings on your server.
95-
2. Modify the `PublishPort` setting in the `pod/quadlet/sheepvibespod.pod` file (e.g., change to `0.0.0.0:5000:5000`).
96-
- If you modify it *before* running `deploy_pod.sh` (e.g., in a cloned repository), the script will use your modified version if it's fetching from your local clone or a specific branch.
97-
- If you modify it *after* deployment by editing `~/.config/containers/systemd/sheepvibespod.pod`, you'll need to run `systemctl --user daemon-reload && systemctl --user restart sheepvibespod-pod.service`.
82+
Once started, the application will be accessible at `http://127.0.0.1:5000` by default. To access the application from other machines, you may need to modify the `PublishPort` setting in `~/.config/containers/systemd/sheepvibespod.pod` (e.g., to `0.0.0.0:5000:5000`) and then run `systemctl --user daemon-reload && systemctl --user restart sheepvibespod-pod.service`.
9883

9984
## Local Development
10085

101-
This section describes how to set up SheepVibes for local development and testing. This typically involves cloning the repository to get all source files and the `Containerfile`.
86+
This section describes how to set up SheepVibes for local development.
10287

10388
### Prerequisites
10489

105-
- Podman installed.
106-
- Git.
107-
- Python environment (optional, for direct backend/frontend work without containers).
90+
* Podman
91+
* Git
92+
* Python 3 and `pip`
10893

10994
### Building the Container
11095

@@ -115,16 +100,14 @@ This section describes how to set up SheepVibes for local development and testin
115100
```
116101

117102
2. **Build the Image**:
118-
Build the application image using the `Containerfile`:
119103
```bash
120104
podman build -t localhost/sheepvibes-app -f Containerfile .
121105
```
122-
Alternatively, use the provided script:
106+
Or use the provided script:
123107
```bash
124-
# Make sure it's executable first: chmod +x scripts/rebuild_container.sh
125108
./scripts/rebuild_container.sh
126109
```
127-
After rebuilding the image, if you are using systemd for production, you must restart the service to use the new image: `systemctl --user restart sheepvibespod-pod.service` (this will recreate containers with the updated image if their `Pull` policy allows or if the image tag changed and Quadlet detects it). Podman typically restarts containers with the newest image version if the image name/tag in the `.container` file is `:latest` and the image is updated locally.
110+
After rebuilding the image, if you are using systemd for production, you must restart the service to use the new image: `systemctl --user restart sheepvibespod-pod.service`.
128111

129112
### Running Locally with Podman
130113

@@ -139,12 +122,8 @@ This section describes how to set up SheepVibes for local development and testin
139122
```
140123

141124
3. **Run the Application Container**:
142-
Create a local directory for the database:
143125
```bash
144126
mkdir -p ./dev_data
145-
```
146-
Run the application container, linking it to Redis and mounting the local data directory:
147-
```bash
148127
podman run -d --name sheepvibes-app-dev \
149128
--network sheepvibes-dev-network \
150129
-p 127.0.0.1:5001:5000 \
@@ -157,55 +136,36 @@ This section describes how to set up SheepVibes for local development and testin
157136
-e FLASK_RUN_HOST=0.0.0.0 \
158137
localhost/sheepvibes-app
159138
```
160-
You can then access the app at `http://127.0.0.1:5001`. Logs can be viewed with `podman logs sheepvibes-app-dev`.
161-
162-
4. **Using `run_dev.sh` (Alternative)**:
163-
The `scripts/run_dev.sh` script provides a way to manage the local development containers. Review and modify it as needed for your local setup.
164-
*(Note: You might need to update `scripts/run_dev.sh` if it's outdated or doesn't match the above setup. The script primarily focuses on running the backend directly without containers for faster iteration).*
139+
The app will be accessible at `http://127.0.0.1:5001`.
165140

166141
### Direct Backend/Frontend Development
167142

168-
This section is for developers who want to work on the Python backend or JavaScript frontend directly, without running the full application in Podman.
169-
170-
1. **Prerequisites:**
171-
* Ensure you have Python 3, `pip`, and a running Redis server (e.g., `podman run -d --name sheepvibes-redis-direct -p 127.0.0.1:6379:6379 redis:alpine`).
143+
1. **Prerequisites**:
144+
* A running Redis server.
172145

173-
2. **Set up Backend Virtual Environment (requires cloning the repo):**
146+
2. **Set up Backend Virtual Environment**:
174147
* Navigate to the `backend` directory: `cd sheepvibes/backend`
175148
* Create a virtual environment: `python -m venv venv`
176-
* Activate it: `source venv/bin/activate` (or `venv\Scripts\activate` on Windows)
149+
* Activate it: `source venv/bin/activate`
177150
* Install dependencies: `pip install -r requirements.txt && pip install -r requirements-dev.txt`
178151

179-
3. **Run the Development Server (Flask Backend - requires cloning the repo):**
180-
The `scripts/run_dev.sh` script can start the Flask backend server directly.
181-
Ensure `CACHE_REDIS_URL` is set, e.g. `export CACHE_REDIS_URL=redis://localhost:6379/0`
152+
3. **Run the Development Server**:
153+
The `scripts/run_dev.sh` script can start the Flask backend server.
182154
```bash
183-
# from the repository root (e.g., cd sheepvibes)
184155
./scripts/run_dev.sh
185156
```
186-
This will typically start the backend on `http://127.0.0.1:5000` (or as configured). The frontend is served statically by Flask in this mode.
187157

188158
## Configuration (Environment Variables)
189159

190-
You can configure the application by passing environment variables.
191-
- When deploying with systemd using Quadlet (via `deploy_pod.sh`), the script downloads a set of default Quadlet files (e.g., `sheepvibes-app.container`, `sheepvibespod.pod`) from `pod/quadlet/`. To customize environment variables for the application:
192-
1. Modify the `Environment=` lines within the `pod/quadlet/sheepvibes-app.container` file (or your local copy at `~/.config/containers/systemd/sheepvibes-app.container` after deployment).
193-
2. After modification, run `systemctl --user daemon-reload && systemctl --user restart sheepvibespod-pod.service`.
194-
- When using `podman run` directly, use the `-e` flag.
195-
- When running the backend directly, set them in your shell environment.
196-
197-
* `DATABASE_PATH`: The full path *inside the container* (or on the host if running directly) where the SQLite database file should be stored. Defaults to `/app/data/sheepvibes.db` (container) or `backend/sheepvibes.db` (direct script). This path is relative to the volume mount specified in `sheepvibes-app.container`.
198-
* `UPDATE_INTERVAL_MINUTES`: The interval (in minutes) at which the application checks feeds for updates. Defaults to `15`.
199-
* `CACHE_REDIS_URL`: The connection URL for the Redis server.
200-
* Pod default (from `sheepvibes-app.container`): `redis://localhost:6379/0` (since Redis is in the same pod).
201-
* `podman run` dev example: `redis://sheepvibes-redis-dev:6379/0`
202-
* Direct script: `redis://localhost:6379/0` (if Redis is on host)
203-
* `FLASK_APP`: Path to the Flask application. Defaults to `backend.app`.
204-
* `PYTHONPATH`: Python module search path. Defaults to `/app` in container.
205-
* `FLASK_RUN_HOST`: Host for Flask development server. Defaults to `0.0.0.0` to be accessible.
160+
* `DATABASE_PATH`: The path to the SQLite database file.
161+
* `UPDATE_INTERVAL_MINUTES`: The interval in minutes for checking for feed updates.
162+
* `CACHE_REDIS_URL`: The URL for the Redis server.
163+
* `FLASK_APP`: The path to the Flask application.
164+
* `PYTHONPATH`: The Python module search path.
165+
* `FLASK_RUN_HOST`: The host for the Flask development server.
206166

207167
## Contributing
208-
(Contributions are welcome. Please open an issue or PR.)
168+
Contributions are welcome. Please open an issue or pull request.
209169

210170
## License
211-
(This project is under a GNU General Public License v3.0 License)
171+
This project is licensed under the GNU General Public License v3.0.

TODO.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ This document outlines the steps to build the SheepVibes RSS aggregator.
9393
* [x] Minimize frontend re-renders.
9494
* [x] **Documentation:**
9595
* [x] Write `README.md` covering setup instructions (building/running with Podman), configuration, and basic usage.
96-
* [x] Add comments to the code.
96+
* [x] Add comments to the code (JSDoc for frontend, Google Style for backend).
9797
* [x] **Testing:**
9898
* [x] Add basic unit tests for backend logic (feed parsing, database interactions).
9999
* [x] Add basic unit tests for backend logic (API endpoints).
@@ -109,8 +109,8 @@ This document outlines the steps to build the SheepVibes RSS aggregator.
109109

110110
## Future Considerations
111111

112+
* [x] Import/Export OPML feed lists.
112113
* [ ] Widget resizing/reordering (drag and drop).
113-
* [ ] Import/Export OPML feed lists.
114114
* [ ] Different widget view types (e.g., list vs. expanded).
115115
* [ ] User authentication.
116116
* [ ] Keyword filtering/highlighting within feeds.

0 commit comments

Comments
 (0)