Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Docker image

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image
run: |
repo_name=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker build -t ghcr.io/${repo_name}/dvb-i-reference-client:latest .

- name: Push Docker image to GitHub Container Registry
run: |
repo_name=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker push ghcr.io/${repo_name}/dvb-i-reference-client:latest
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM php:8.1-apache

COPY ./ /var/www/html/client

RUN a2enmod rewrite
RUN a2enmod expires
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,50 @@ This will create opapp.pkg in the project root directory. Edit the [XML AIT](htt
Backend is deployable to any web server with PHP support. Make sure that the "servicelists" directory is writable. The backend stores new servicelists there.

NOTE: The frontend uses "example.xml" as the service list. It can be browsed in the Backend editor as well, but not modified. [https://dvb-i-reference.dvb.org/client/backend/servicelists/example.xml](https://dvb-i-reference.dvb.org/client/backend/servicelists/example.xml)

## Installation Alternative with Docker

For ease of deployment and development, you can utilize Docker to run the DVB-I Reference Application. This method allows you to quickly set up an environment without requiring manual configuration.

### Prerequisites

Before proceeding, ensure that you have the following installed on your system:
- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)

### Steps for Docker Deployment

1. **Clone the Repository**:
Begin by cloning the repository to your local machine.
```bash
git clone https://github.com/DVBProject/DVB-I-Reference-Client.git
cd DVB-I-Reference-Client
```

2. **Run Docker Containers**:
Use the provided `docker-compose.yml` file to run the container.
```bash
docker-compose up -d
```

3. **Access the Application**:
Once the containers are up and running, you can access the DVB-I Reference Application by navigating to [http://localhost:8888/client](http://localhost:8888/client) in your web browser.

### Development Mode with Docker Volumes

If you prefer to work in a development mode, where changes to the source code are reflected immediately, you can use Docker volumes:

1. **Uncomment volume mapping at docker-compose.yml**:
```yml
volumes:
- ./:/var/www/html/client
```

2. **Run Docker Containers**:
Use the modified `docker-compose.yml` file to run the container.
```bash
docker-compose up -d
```

3. **Access the Application**:
Continue to access the application via [http://localhost:8888/client](http://localhost:8888/client).
2 changes: 1 addition & 1 deletion backend/configuration.php
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using environment variable to set the $install_location in the backend might be problematic outside the docker container. As far as I understand, the environment variables need to be configured on the web server level ( apache or nginx php configuration ). If the backend is used form a user directory they may not have the option to change the web server configuration and if there are multiple users in the same domain then they would need different environment variables.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps something like this would be a good way for both use cases? use the environment variable and there is a fallback value if the environment variable is not set?

<?php
//
// install_location is the installation directory
// see also frontend/configuration.js
//

//Docker uses install location from environment variable
if(isset($_ENV['INSTALL_LOCATION'])) {
  $install_location = $_ENV['INSTALL_LOCATION']
}
else {
  //configure install location here if used without docker
  $install_location = "https://dvb-i-reference.dvb.org/client";
}
?>

Perhaps the environment variable name should be more specific to avoid possible collisions? Maybe "DVB_I_INSTALL_LOCATION"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to deal with frontend/confiiguration.js which currently has the absolute URL to the installed backend. If the backend and frontend are both running in the same machine, then 'localhost' can be used - but this is seldom the situation

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// install_location is the installation directory
// see also frontend/configuration.js
//
$install_location = "https://dvb-i-reference.dvb.org/client";
$install_location = $_ENV['INSTALL_LOCATION'];
?>
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '1.0'
services:
dvb-i-reference-client:
# Comment build and uncomment image if you want to use prebuilt image rather than build from the source code
# build: .
image: ghcr.io/ccma-enginyeria/dvb-i-reference-client/dvb-i-reference-client:latest
# Uncomment volumes if you want to use the source code rather than use from docker image
# volumes:
# - ./:/var/www/html/client
environment:
- INSTALL_LOCATION=${INSTALL_LOCATION:-http://localhost:8888/client}
ports:
- "8888:80"
2 changes: 1 addition & 1 deletion frontend/configuration.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to see a solution where this file (and probably backend/configuration.php also) can be used in different scenarios. This change means that the frontend and backend are running in the same container - ideally the backend should run in the container and provide the separate frontend client with INSTALL_LOCATION in frontend/configuration.js based on the container address

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DVB-I Reference installation location -- also backend/configuration.php
var INSTALL_LOCATION = "https://dvb-i-reference.dvb.org/client";
var INSTALL_LOCATION = "/client";

// set to true to include <Service> channels that are not included in the selected LCN table.
var INCLUDE_NON_LCN_CHANNELS = false;