Skip to content

Commit

Permalink
Merge branch 'master' into geo-dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Sep 9, 2024
2 parents 2830562 + 5f6861a commit 166f828
Show file tree
Hide file tree
Showing 375 changed files with 14,492 additions and 7,336 deletions.
3 changes: 0 additions & 3 deletions .docker/all-php.ini

This file was deleted.

23 changes: 6 additions & 17 deletions .docker/app.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# PHP 8.1.13
#FROM php:8.1-fpm-alpine
FROM php@sha256:88407bcb4821e7a9da273d9dad746e1f795e9a6480d9cba5ba502d7836e23718
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core
# PHP 8.2.21
#FROM php:8.2-fpm-alpine
FROM php@sha256:95c34aeeef07aa9774e0b70d5b70065ab0647ece183ebe007c5f2e6b5db16725
LABEL org.opencontainers.image.authors="Martin Zurowietz <m.zurowietz@uni-bielefeld.de>"
LABEL org.opencontainers.image.source="https://github.com/biigle/core"

RUN ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
ADD ".docker/all-php.ini" "$PHP_INI_DIR/conf.d/all.ini"
ADD ".docker/app-php.ini" "$PHP_INI_DIR/conf.d/app.ini"

RUN apk add --no-cache \
Expand All @@ -29,17 +28,7 @@ RUN apk add --no-cache \

RUN apk add --no-cache exiftool

# Configure proxy if there is any. See: https://stackoverflow.com/a/2266500/1796523
RUN [ -z "$HTTP_PROXY" ] || pear config-set http_proxy $HTTP_PROXY
RUN apk add --no-cache yaml \
&& apk add --no-cache --virtual .build-deps g++ make autoconf yaml-dev \
&& pecl install yaml \
&& docker-php-ext-enable yaml \
&& apk del --purge .build-deps
# Unset proxy configuration again.
RUN [ -z "$HTTP_PROXY" ] || pear config-set http_proxy ""

ARG PHPREDIS_VERSION=5.3.7
ARG PHPREDIS_VERSION=6.0.2
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
&& tar -xzf /tmp/redis.tar.gz \
&& rm /tmp/redis.tar.gz \
Expand Down
6 changes: 3 additions & 3 deletions .docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This file is just used to get security alerts from GitHub. Make sure the versions match
# in worker.dockerfile.
numpy==1.24.*
opencv-contrib-python-headless==4.6.0
opencv-contrib-python-headless==4.8.1.78
scipy==1.10.*
scikit-learn==1.2.*
matplotlib==3.6.*
PyExcelerate==0.6.7
Pillow==10.3.0
Shapely==1.8.1
torch==2.1.*
torchvision==0.16.*
torch==2.2.*
torchvision==0.17.*
pandas==1.5.3
4 changes: 2 additions & 2 deletions .docker/web.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FROM nginx:1.21-alpine
FROM nginx@sha256:5a0df7fb7c8c03e4158ae9974bfbd6a15da2bdfdeded4fb694367ec812325d31
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core
LABEL org.opencontainers.image.authors="Martin Zurowietz <m.zurowietz@uni-bielefeld.de>"
LABEL org.opencontainers.image.source="https://github.com/biigle/core"

ADD .docker/vhost.conf /etc/nginx/conf.d/default.conf
ADD .docker/ffdhe2048.txt /etc/nginx/conf.d/ffdhe2048.txt
Expand Down
49 changes: 16 additions & 33 deletions .docker/worker.dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PHP 8.1.27
# FROM php:8.1
FROM php@sha256:9b5dfb7deef3e48d67b2599e4d3967bb3ece19fd5ba09cb8e7ee10f5facf36e0
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core
# PHP 8.2.21
# FROM php:8.2
FROM php@sha256:a61daae986bdf9bbeff9a514e3598a4f72bb2e3d01a0b3d0eff960bbfe85acdf
LABEL org.opencontainers.image.authors="Martin Zurowietz <m.zurowietz@uni-bielefeld.de>"
LABEL org.opencontainers.image.source="https://github.com/biigle/core"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -21,17 +21,21 @@ RUN LC_ALL=C.UTF-8 apt-get update \
&& rm -r /var/lib/apt/lists/*

RUN ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
ADD ".docker/all-php.ini" "$PHP_INI_DIR/conf.d/all.ini"
# Enable FFI for jcupitt/vips.
# See: https://github.com/libvips/php-vips?tab=readme-ov-file#install
RUN echo "ffi.enable = true" > "$PHP_INI_DIR/conf.d/vips.ini"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libxml2-dev \
libzip-dev \
libpq-dev \
libffi-dev \
&& apt-get install -y --no-install-recommends \
libxml2 \
libzip4 \
postgresql-client \
libffi8 \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/bin/pgsql \
&& docker-php-ext-install -j$(nproc) \
exif \
Expand All @@ -41,50 +45,29 @@ RUN LC_ALL=C.UTF-8 apt-get update \
pgsql \
soap \
zip \
ffi \
&& apt-get purge -y \
libxml2-dev \
libzip-dev \
libpq-dev \
libffi-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

# Configure proxy if there is any. See: https://stackoverflow.com/a/2266500/1796523
RUN [ -z "$HTTP_PROXY" ] || pear config-set http_proxy $HTTP_PROXY

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libyaml-dev \
&& apt-get install -y --no-install-recommends \
libyaml-0-2 \
&& pecl install yaml \
&& printf "\n" | docker-php-ext-enable yaml \
&& apt-get purge -y \
libyaml-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

ARG PHPREDIS_VERSION=5.3.7
ARG PHPREDIS_VERSION=6.0.2
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
&& tar -xzf /tmp/redis.tar.gz \
&& rm /tmp/redis.tar.gz \
&& mkdir -p /usr/src/php/ext \
&& mv phpredis-${PHPREDIS_VERSION} /usr/src/php/ext/redis \
&& docker-php-ext-install -j$(nproc) redis

# ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libvips-dev \
&& apt-get install -y --no-install-recommends \
libvips42 \
&& pecl install vips \
&& docker-php-ext-enable vips \
&& apt-get purge -y \
libvips-dev \
&& apt-get -y autoremove \
&& apt-get install -y --no-install-recommends libvips42 \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

Expand All @@ -98,8 +81,8 @@ RUN LC_ALL=C.UTF-8 apt-get update \
PyExcelerate==0.6.7 \
Pillow==10.2.0 \
&& pip3 install --no-cache-dir --break-system-packages --index-url https://download.pytorch.org/whl/cpu \
torch==2.1.* \
torchvision==0.16.* \
torch==2.2.* \
torchvision==0.17.* \
&& apt-get purge -y \
python3-pip \
&& apt-get -y autoremove \
Expand Down
30 changes: 23 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ APP_DEBUG=true
APP_URL="http://localhost:8000"
APP_TIMEZONE="Europe/Berlin"

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=single
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Expand Down Expand Up @@ -40,23 +50,29 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
#HTTP_PROXY=host:port

# normally you don't have to edit these
CACHE_DRIVER="file"
FILESYSTEM_DISK=local
SESSION_DRIVER="file"
SESSION_LIFETIME=120
SESSION_SECURE_COOKIE=false
QUEUE_CONNECTION="database"
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=file
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST="127.0.0.1"
REDIS_PASSWORD=null
REDIS_PORT=6379

# see config/mail.php for what drivers are available
# default is the PHP mail function which doesn't require any credentials
MAIL_MAILER="log"
MAIL_HOST="smtp.mailtrap.io"
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'

- uses: actions/checkout@v1
with:
Expand All @@ -50,8 +50,8 @@ jobs:
- name: Set testing key
run: echo "APP_KEY=base64:STZFA4bQKDjE2mlpRPmsJ/okG0eCh4RHd9BghtZeYmQ=" >> .env

- name: Run Psalm
run: composer lint
- name: Run Linter
run: composer lint -- --error-format=github

cs-php:

Expand All @@ -61,7 +61,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: cs2pr

- uses: actions/checkout@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/public/vendor
/storage/*.key
/storage/largo_patches
/storage/metadata
/storage/pending-metadata
/vendor
.env
.env.backup
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
Expand Down
7 changes: 4 additions & 3 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ To develop BIIGLE on your local machine you can use Docker containers. This way
First, install the following software:

- PHP >= 8.0
- [Docker](https://docs.docker.com/install/)
- [Docker Engine](https://docs.docker.com/engine/install/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos)
- Recommended: The `unzip` tool

On Linux: Make sure to add your user to the new `docker` group with `sudo usermod -aG docker $(whoami)`, then log out and back in. Otherwise you have to call all `docker` or `docker compose` commands with `sudo`.
> [!IMPORTANT]
> The link above points to Docker Engine on purpose. Docker Desktop (on Linux) may have problems mounting the filesystem with the correct permissions.
**Note:** Older versions of Docker Compose used the `docker-compose` command. Newer versions use `docker compose`.
On Linux: Make sure to add your user to the new `docker` group with `sudo usermod -aG docker $(whoami)`, then log out and back in. Otherwise you have to call all `docker` or `docker compose` commands with `sudo`.

Now you can proceed with the development setup:

Expand Down
21 changes: 13 additions & 8 deletions app/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
/**
* An image annotation is a region of an image that can be labeled by the users.
* It consists of one or many points and has a specific shape.
*
* @property int $id
* @property array $points
* @property string $created_at
* @property int $shape_id
*/
abstract class Annotation extends Model implements AnnotationContract
{
Expand All @@ -19,7 +24,7 @@ abstract class Annotation extends Model implements AnnotationContract
/**
* The attributes excluded from the model's JSON form.
*
* @var array
* @var array<int, string>
*/
protected $hidden = [
'pivot',
Expand All @@ -28,7 +33,7 @@ abstract class Annotation extends Model implements AnnotationContract
/**
* The attributes that should be casted to native types.
*
* @var array
* @var array<string, string>
*/
protected $casts = [
'points' => 'array',
Expand All @@ -40,7 +45,7 @@ abstract class Annotation extends Model implements AnnotationContract
* @param \Illuminate\Database\Query\Builder $query
* @param User $user The user to whom the restrictions should apply ('own' user)
*
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Query\Builder
*/
public function scopeVisibleFor($query, User $user)
{
Expand Down Expand Up @@ -73,7 +78,7 @@ public function scopeVisibleFor($query, User $user)
* @param \Illuminate\Database\Query\Builder $query
* @param Label $label
*
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Query\Builder
*/
public function scopeWithLabel($query, Label $label)
{
Expand All @@ -93,7 +98,7 @@ public function scopeWithLabel($query, Label $label)
* @param \Illuminate\Database\Query\Builder $query
* @param AnnotationSession $session
* @param User $user The user to whom the restrictions should apply ('own' user)
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Query\Builder
*/
public function scopeAllowedBySession($query, AnnotationSession $session, User $user)
{
Expand Down Expand Up @@ -153,14 +158,14 @@ public function scopeAllowedBySession($query, AnnotationSession $session, User $
/**
* The file, this annotation belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<covariant VolumeFile, covariant Annotation>
*/
abstract public function file();

/**
* The labels, this annotation got assigned by the users.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
* @return \Illuminate\Database\Eloquent\Relations\HasMany<covariant AnnotationLabel>
*/
abstract public function labels();

Expand All @@ -174,7 +179,7 @@ abstract public function getFileIdAttribute();
/**
* The shape of this annotation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Shape, Annotation>
*/
public function shape()
{
Expand Down
Loading

0 comments on commit 166f828

Please sign in to comment.