Skip to content

Commit b0499b7

Browse files
authored
Merge pull request #123 from Ente/TT-71-1
TT-71: Dockerized version
2 parents 86abe1e + 7be914f commit b0499b7

File tree

8 files changed

+72
-5
lines changed

8 files changed

+72
-5
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.git
2+
.gitignore
3+
vendor
4+
node_modules
5+
Dockerfile
6+
docker-compose.yml
7+
*.md
8+
*.log
9+
tests

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# CHANGELOG
22

3+
## v8.2.2
4+
5+
* Fixed deprecation warning for `WorktimeAddedEvent` event
6+
* Dockerized TimeTrack:
7+
* Added `Dockerfile` and `docker-compose.yml` to run TimeTrack within Docker
8+
* Added `entrypoint.sh` to handle database migrations and start Apache
9+
* Updated `README.md` with Docker instructions
10+
311
## v8.2.1
412

513
* Added events for worktime correction proposals: `WorktimeCorrectionProposed`

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ TimeTrack aims to be an easy-to-use time recording software for small enterprise
1919

2020
## Installation
2121

22+
### Quick Install with Docker
23+
24+
You can quickly get started with TimeTrack using Docker. Follow these steps:
25+
26+
* Ensure you have Docker and Docker Compose installed on your system.
27+
* Clone the TimeTrack repository: `git clone https://github.com/Ente/timetrack.git` & `cd timetrack`
28+
* Build the Docker image: `docker build -t openducks/timetrack .`
29+
* Create a `app.json` configuration file based on the provided sample below: `cp api/v1/inc/app.json.sample api/v1/inc/app.json` and edit it to fit your needs.
30+
* Adjust the database settings if needed (at least `db_password`)
31+
* Change the base_url to match your setup (e.g. `localhost:8080`)
32+
* **Change the DB password before using in production within the `docker-compose.yml` and `app.json` file!**
33+
* Start the services using Docker Compose: `docker-compose up -d`
34+
* Access TimeTrack in your web browser at `http://localhost:8080`
35+
36+
Certain features, like the NFC login may require additional setup for parsing the USB device.
37+
2238
### Requirements
2339

2440
- PHP 8.2 (`curl|gd|gmp|intl|mbstring|mysqli|openssl|xsl|gettext|dom|ldap`) - tested with PHP 8.2.26

api/v1/class/events/worktimes/WorktimeAddedEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class WorktimeAddedEvent extends Event
1212

1313
private string $Wtype;
1414

15-
public function __construct(string $username, array $dates = [], int $Wtype){
15+
public function __construct(string $username, int $Wtype, array $dates = []){
1616
$this->username = $username;
1717
$this->dates = $dates;
1818
$this->Wtype = $Wtype;

api/v1/class/projects/projects.arbeit.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function __construct()
99
$this->db = new DB;
1010
}
1111

12-
public function addProject($name, $description = null, $items_assoc, $deadline = null, $owner = null)
12+
public function addProject($name, $items_assoc, $description = null, $deadline = null, $owner = null)
1313
{
1414
Exceptions::error_rep("[PROJECTS] Adding project...");
1515
if ($items_assoc == null) {

api/v1/inc/app.json.sample

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"force_theme": "false"
1212
},
1313
"mysql": {
14-
"db_host": "localhost",
15-
"db_user": "root",
16-
"db_password": "",
14+
"db_host": "db",
15+
"db_user": "timetool",
16+
"db_password": "yourpassword",
1717
"db": "ab"
1818
},
1919
"smtp": {

docker/apache2.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<VirtualHost *:80>
2+
DocumentRoot /var/www/html
3+
<Directory /var/www/html>
4+
Options Indexes FollowSymLinks
5+
AllowOverride All
6+
Require all granted
7+
</Directory>
8+
9+
ErrorLog ${APACHE_LOG_DIR}/error.log
10+
CustomLog ${APACHE_LOG_DIR}/access.log combined
11+
</VirtualHost>

docker/entrypoint.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Waiting for the database to be ready
5+
echo "Waiting for database to be ready..."
6+
sleep 10
7+
8+
# Run Phinx migrations
9+
echo "Running database migrations..."
10+
if [ -f /var/www/html/vendor/bin/phinx ]; then
11+
php /var/www/html/vendor/bin/phinx migrate || true
12+
else
13+
echo "Phinx not found — skipping migration."
14+
fi
15+
16+
# Start PC/SC daemon for smartcard/NFC
17+
echo "Starting pcscd..."
18+
pcscd --daemon &
19+
20+
21+
# Start Apache
22+
echo "Starting Apache..."
23+
exec apache2-foreground

0 commit comments

Comments
 (0)