Skip to content

Commit 9e47568

Browse files
authored
Merge branch 'dev' into 1657-unsalted-hashlist
2 parents 4c11b58 + 019c501 commit 9e47568

File tree

203 files changed

+4122
-1852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+4122
-1852
lines changed

.devcontainer/docker-compose.yml renamed to .devcontainer/docker-compose.mysql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
- CONTAINER_USER_CMD_PRE
1010
- CONTAINER_USER_CMD_POST
1111
environment:
12+
HASHTOPOLIS_DB_TYPE: mysql
1213
HASHTOPOLIS_DB_USER: hashtopolis
1314
HASHTOPOLIS_DB_PASS: hashtopolis
1415
HASHTOPOLIS_DB_HOST: hashtopolis-db-dev
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: "3.7"
2+
services:
3+
hashtopolis-server-dev:
4+
container_name: hashtopolis-server-dev
5+
build:
6+
context: ..
7+
target: hashtopolis-server-dev
8+
args:
9+
- CONTAINER_USER_CMD_PRE
10+
- CONTAINER_USER_CMD_POST
11+
environment:
12+
HASHTOPOLIS_DB_TYPE: postgres
13+
HASHTOPOLIS_DB_USER: hashtopolis
14+
HASHTOPOLIS_DB_PASS: hashtopolis
15+
HASHTOPOLIS_DB_HOST: hashtopolis-db-dev
16+
HASHTOPOLIS_DB_DATABASE: hashtopolis
17+
HASHTOPOLIS_APIV2_ENABLE: 1
18+
depends_on:
19+
- hashtopolis-db-dev
20+
ports:
21+
- "8080:80"
22+
volumes:
23+
# This is where VS Code should expect to find your project's source code
24+
# and the value of "workspaceFolder" in .devcontainer/devcontainer.json
25+
- ..:/var/www/html
26+
- hashtopolis-server-dev:/usr/local/share/hashtopolis:Z
27+
networks:
28+
- hashtopolis_dev
29+
hashtopolis-db-dev:
30+
container_name: hashtopolis-db-dev
31+
image: postgres:13
32+
restart: always
33+
ports:
34+
- "5432:5432"
35+
volumes:
36+
- hashtopolis-db-dev:/var/lib/postgresql/data
37+
environment:
38+
POSTGRES_DB: hashtopolis
39+
POSTGRES_USER: hashtopolis
40+
POSTGRES_PASSWORD: hashtopolis
41+
networks:
42+
- hashtopolis_dev
43+
44+
volumes:
45+
hashtopolis-db-dev:
46+
hashtopolis-server-dev:
47+
48+
networks:
49+
hashtopolis_dev:
50+
# This network will also be used by the python-agent
51+
name: hashtopolis_dev
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
name: Start Hashtopolis server
22
description: Starts application containers and waits for Hashtopolis to be ready.
33

4+
inputs:
5+
db_system:
6+
description: "Used to set which DB system should be used"
7+
required: true
8+
default: "mysql"
9+
options:
10+
- "mysql"
11+
- "postgres"
12+
413
runs:
514
using: "composite"
615
steps:
716
- name: Start application containers
8-
working-directory: .devcontainer
9-
run: docker compose up -d
10-
shell: bash
11-
- name: Install composer dependencies packages
12-
run: docker exec hashtopolis-server-dev composer install --working-dir=/var/www/html/
17+
working-directory: .github
18+
run: docker compose -f docker-compose.${{ inputs.db_system }}.yml up -d
1319
shell: bash
20+
# should not be needed anymore as it is installed during build
21+
# - name: Install composer dependencies packages
22+
# run: docker exec hashtopolis-server-dev composer install --working-dir=/var/www/html/
23+
# shell: bash
1424
- name: Wait until entrypoint is finished and Hashtopolis is started
1525
run: bash .github/scripts/await-hashtopolis-startup.sh
1626
shell: bash

.github/docker-compose.mysql.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: "3.7"
2+
services:
3+
hashtopolis-server-dev:
4+
container_name: hashtopolis-server-dev
5+
build:
6+
context: ..
7+
target: hashtopolis-server-dev
8+
args:
9+
- CONTAINER_USER_CMD_PRE
10+
- CONTAINER_USER_CMD_POST
11+
environment:
12+
HASHTOPOLIS_DB_TYPE: mysql
13+
HASHTOPOLIS_DB_USER: hashtopolis
14+
HASHTOPOLIS_DB_PASS: hashtopolis
15+
HASHTOPOLIS_DB_HOST: hashtopolis-db-dev
16+
HASHTOPOLIS_DB_DATABASE: hashtopolis
17+
HASHTOPOLIS_APIV2_ENABLE: 1
18+
depends_on:
19+
- hashtopolis-db-dev
20+
ports:
21+
- "8080:80"
22+
volumes:
23+
- hashtopolis-server-dev:/usr/local/share/hashtopolis:Z
24+
networks:
25+
- hashtopolis_dev
26+
hashtopolis-db-dev:
27+
container_name: hashtopolis-db-dev
28+
image: mysql:8.0
29+
restart: always
30+
ports:
31+
- "3306:3306"
32+
volumes:
33+
- hashtopolis-db-dev:/var/lib/mysql
34+
environment:
35+
MYSQL_ROOT_PASSWORD: hashtopolis
36+
MYSQL_DATABASE: hashtopolis
37+
MYSQL_USER: hashtopolis
38+
MYSQL_PASSWORD: hashtopolis
39+
networks:
40+
- hashtopolis_dev
41+
volumes:
42+
hashtopolis-db-dev:
43+
hashtopolis-server-dev:
44+
45+
networks:
46+
hashtopolis_dev:
47+
name: hashtopolis_dev
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: "3.7"
2+
services:
3+
hashtopolis-server-dev:
4+
container_name: hashtopolis-server-dev
5+
build:
6+
context: ..
7+
target: hashtopolis-server-dev
8+
args:
9+
- CONTAINER_USER_CMD_PRE
10+
- CONTAINER_USER_CMD_POST
11+
environment:
12+
HASHTOPOLIS_DB_TYPE: postgres
13+
HASHTOPOLIS_DB_USER: hashtopolis
14+
HASHTOPOLIS_DB_PASS: hashtopolis
15+
HASHTOPOLIS_DB_HOST: hashtopolis-db-dev
16+
HASHTOPOLIS_DB_DATABASE: hashtopolis
17+
HASHTOPOLIS_APIV2_ENABLE: 1
18+
depends_on:
19+
- hashtopolis-db-dev
20+
ports:
21+
- "8080:80"
22+
volumes:
23+
- hashtopolis-server-dev:/usr/local/share/hashtopolis:Z
24+
networks:
25+
- hashtopolis_dev
26+
hashtopolis-db-dev:
27+
container_name: hashtopolis-db-dev
28+
image: postgres:13
29+
restart: always
30+
ports:
31+
- "5432:5432"
32+
volumes:
33+
- hashtopolis-db-dev:/var/lib/postgresql/data
34+
environment:
35+
POSTGRES_DB: hashtopolis
36+
POSTGRES_USER: hashtopolis
37+
POSTGRES_PASSWORD: hashtopolis
38+
networks:
39+
- hashtopolis_dev
40+
41+
volumes:
42+
hashtopolis-db-dev:
43+
hashtopolis-server-dev:
44+
45+
networks:
46+
hashtopolis_dev:
47+
name: hashtopolis_dev

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ on:
1313
jobs:
1414
build:
1515
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
include:
19+
- db_system: mysql
20+
- db_system: postgres
1621
steps:
1722
- name: Checkout repository
1823
uses: actions/checkout@v3
1924
- name: Start Hashtopolis server
2025
uses: ./.github/actions/start-hashtopolis
26+
with:
27+
db_system: ${{ matrix.db_system }}
2128
- name: Give Apache permissions on necessary directories # for the tests, only src/files and src/inc/utils/locks seem necessary
2229
run: docker exec -u root hashtopolis-server-dev bash -c "chown -R www-data:www-data /var/www/html/src && chmod -R g+w /var/www/html/src"
23-
- name: Run test suite
24-
run: docker exec hashtopolis-server-dev php /var/www/html/ci/run.php -vmaster
2530
- name: Test with pytest
2631
run: docker exec hashtopolis-server-dev pytest /var/www/html/ci/apiv2
2732
- name: Test if pytest is removing all test objects

.github/workflows/docs-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
sudo apt-get install npm
3030
- name: Start Hashtopolis server
3131
uses: ./.github/actions/start-hashtopolis
32+
with:
33+
db_system: "mysql"
3234
- name: Download newest apiv2 spec
3335
run: |
3436
wget http://localhost:8080/api/v2/openapi.json -P /tmp/

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ jobs:
2626
sudo apt-get install php
2727
sudo apt-get install -y lftp
2828
sudo apt-get install nodejs
29-
sudo apt-get install npm
29+
sudo apt-get install npm
3030
- name: Start Hashtopolis server
3131
uses: ./.github/actions/start-hashtopolis
32+
with:
33+
db_system: "mysql"
3234
- name: Download newest apiv2 spec
3335
run: |
3436
wget http://localhost:8080/api/v2/openapi.json -P /tmp/

000-default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Require all granted
1313
</Directory>
1414
Header always set Referrer-Policy "same-origin"
15-
Header always set Feature-Policy "geolocation none;midi none;notifications none;push none;sync-xhr self;microphone none;camera none;magnetometer none;gyroscope none;speaker none;vibrate none;fullscreen self;payment none;"
15+
Header always set Permissions-Policy "geolocation none;midi none;notifications none;push none;sync-xhr self;microphone none;camera none;magnetometer none;gyroscope none;speaker none;vibrate none;fullscreen self;payment none;bluetooth none;display-capture none;usb none;"
1616
Header always set Content-Security-Policy "frame-ancestors 'none';"
1717
Header always set X-Frame-Options "DENY"
1818
Header always set X-Content-Type-Options "nosniff"

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
FROM rust:1.91-trixie AS prebuild
2+
3+
RUN cargo install sqlx-cli --no-default-features --features native-tls,mysql,postgres
4+
15
FROM alpine/git AS preprocess
26

37
COPY .gi[t] /.git
@@ -6,7 +10,7 @@ RUN cd / && git rev-parse --short HEAD > /HEAD; exit 0
610

711
# BASE image
812
# ----BEGIN----
9-
FROM php:8-apache AS hashtopolis-server-base
13+
FROM php:8.4-apache AS hashtopolis-server-base
1014

1115
# Enable possible build args for injecting user commands
1216
ARG CONTAINER_USER_CMD_PRE
@@ -37,12 +41,12 @@ RUN apt-get update \
3741
#
3842
# Install git, procps, lsb-release (useful for CLI installs)
3943
&& apt-get -y install git iproute2 procps lsb-release \
40-
&& apt-get -y install mariadb-client \
44+
&& apt-get -y install mariadb-client postgresql-client libpq-dev \
4145
&& apt-get -y install libpng-dev \
4246
&& apt-get -y install ssmtp \
4347
\
4448
# Install extensions (optional)
45-
&& docker-php-ext-install pdo_mysql gd \
49+
&& docker-php-ext-install pdo_mysql pgsql pdo_pgsql gd \
4650
\
4751
# Install Composer
4852
&& curl -sS https://getcomposer.org/installer | php \
@@ -82,6 +86,8 @@ RUN mkdir -p ${HASHTOPOLIS_DOCUMENT_ROOT} \
8286
&& chown www-data:www-data ${HASHTOPOLIS_BINARIES_PATH} \
8387
&& chmod g+w ${HASHTOPOLIS_BINARIES_PATH}
8488

89+
COPY --from=prebuild /usr/local/cargo/bin/sqlx /usr/bin/
90+
8591
COPY --from=preprocess /HEA[D] ${HASHTOPOLIS_DOCUMENT_ROOT}/../.git/
8692

8793
# Install composer
@@ -104,7 +110,7 @@ ENTRYPOINT [ "docker-entrypoint.sh" ]
104110
FROM hashtopolis-server-base AS hashtopolis-server-dev
105111

106112
# Setting up development requirements, install xdebug
107-
RUN yes | pecl install xdebug-3.4.0beta1 && docker-php-ext-enable xdebug \
113+
RUN yes | pecl install xdebug && docker-php-ext-enable xdebug \
108114
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
109115
&& echo "xdebug.mode = debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
110116
&& echo "xdebug.start_with_request = yes" >> /usr/local/etc/php/conf.d/xdebug.ini \

0 commit comments

Comments
 (0)