- FastAPI backend with news scraping from Yahoo Japan - SQLite database for article storage - Web UI with dark mode, article modal, statistics dashboard - Docker support for containerized deployment - API endpoints: /api/today, /api/news, /api/collect-news, /api/dates, /api/download-json - Auto-collect feature when requesting today news - Content filtering for articles without body text
53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
# Deployment Guide for Japan News Collector
|
|
|
|
This guide explains how to deploy the application using Docker on your home server or any machine with Docker installed.
|
|
|
|
## Prerequisites
|
|
|
|
- [Docker](https://docs.docker.com/get-docker/) installed.
|
|
- [Docker Compose](https://docs.docker.com/compose/install/) installed (usually included with Docker Desktop/Docker Engine).
|
|
|
|
## Files Overview
|
|
|
|
- **Dockerfile**: Defines the environment (Python 3.9) and dependencies.
|
|
- **docker-compose.yml**: Orchestrates the container, maps ports (8000), and persists data (`news.db`).
|
|
|
|
## Deployment Steps
|
|
|
|
1. **Transfer Files**: Copy the entire project folder to your server.
|
|
2. **Navigate to Directory**:
|
|
```bash
|
|
cd japan-news
|
|
```
|
|
3. **Start the Service**:
|
|
Run the following command to build and start the container in the background:
|
|
```bash
|
|
docker-compose up -d --build
|
|
```
|
|
|
|
## Managing the Service
|
|
|
|
- **Check Logs**:
|
|
```bash
|
|
docker-compose logs -f
|
|
```
|
|
- **Stop the Service**:
|
|
```bash
|
|
docker-compose down
|
|
```
|
|
- **Restart**:
|
|
```bash
|
|
docker-compose restart
|
|
```
|
|
|
|
## Data Persistence
|
|
|
|
The database file `news.db` is mapped to the container.
|
|
- Even if you stop or remove the container, your data in `news.db` on the host machine will remain safe.
|
|
- **Backup**: Simply backup the `news.db` file.
|
|
|
|
## Accessing the Application
|
|
|
|
Open your browser and navigate to:
|
|
`http://localhost:8000` (or your server's IP address: `http://<server-ip>:8000`)
|