# DTP Newsroom A virtual newsroom powered by RSS and AI that produces its own watchable media and publishes it online. ## Web Application The DTP Newsroom website. ## Newsroom Worker A running process that fetches news stories, creates audiovisual media from those stories, and publishes them. # Getting Started You will repeat this host configuration process for each host system and running process added to the DTP infrastructure. ## Host Configuration Ubuntu is the only tested and supported host operating system for DTP. [Ubuntu 24.04 LTS](https://ubuntu.com/download) is recommended for development, testing, and hosting. Ubuntu 24.10 can be used for workstation duties, but 24.04 LTS is recommended for hosting. Supervisor is used to manage Control and Agent Node process instances. ### System Requirements Make sure you've got the latest/greatest for your Ubuntu. ```sh apt -y update && apt -y upgrade apt -y install python3-pip build-essential ffmpeg supervisor ``` ### Install Node Version Manager (NVM) and Node.js [Node Version Manager](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating) is used to manage the Node.js installation on the host. First, install `nvm`: #### Using cURL ```sh curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash ``` #### Using wget ```sh wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash ``` Next, run `nvm` to install the current LTS version of Node.js: ```sh nvm install --lts ``` ### pnpm (NPM alternative) DTP Newsroom uses the [pnpm](https://pnpm.io/) package manager to manage the `node_modules` directory and provide runtime services. [Corepack](https://nodejs.org/api/corepack.html), a Node.js utility, is used to install and enable `pnpm` for use. The latest pnpm instructions can always be found here: [pnpm installation](https://pnpm.io/installation) These are just convenience copies from that page. ```sh corepack enable pnpm corepack use pnpm@latest ``` And then run `pnpm` to install the DTP Newsroom application dependencies: ```sh pnpm install ``` ## Preparing a Fresh Install This is the basic configuration of a Node in the DTP network. Once these steps are completed, the host is ready to start the Web application, Newsroom Worker, or both. ```sh cd ~/live git clone [DTP_NEWSROOM_GIT_URL] cd ~/live/dtp-newsroom pnpm install ``` Next, you have to generate an SSL certificate for your local builds: ```sh cd ~/live/dtp-newsroom/ssl ./mkcert ``` ## Controlling The Processes ### Development Environment A developer working in a local directory will use `pnpm` scripts to start the Web application and Newsroom Worker as needed. VS Code launchers are also provided with TypeScript debug configurations that debug the TypeScript sources directly. #### Start Web Application ```sh pnpm start-web pnpm web-dev ``` #### Start Newsroom Worker ```sh pnpm start-newsroom pnpm newsroom-dev ``` ### Test and Production Environments #### supervisord The system administrator will use Supervisor to manage the Control and Agent Node processes. Sample configuration files are provided here in the repo for use with [supervisord]: - [newsroom-web.conf](./supervisord/newsroom-web.conf) - [newsroom-worker.conf](./supervisord/newsroom-worker.conf) The system administrator may need to specialize those configurations for various differences in how they store logs, where they choose to install and manage the application, etc. #### Logs By default, DTP Newsroom will write logs to `/var/log/dtp`. The system administrator in test and production environments, or the developer in local environments, manages the logs directory using `DTP_LOG_FILE_PATH` in [.env](docs/env.md). Log files are written with ANSI color. to view them in a terminal over an SSH connection, use the following command: ```sh less -r logfile.log ``` In production environments, Supervisor can be used to tail process logs in real time. To get a list of running processes: ```sh supervisorctl status ``` To tail the logs of a running process: ```sh supervisorctl tail -f [process] ```