make shim a container once again

This commit is contained in:
Murphy 2024-12-25 12:32:15 -05:00
parent 0722462a84
commit 170f39e707
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17
5 changed files with 52 additions and 12 deletions

17
build/shim/Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM alpine:latest
# install packages
RUN apk add --no-cache \
php84 \
php84-pdo \
php84-pdo_sqlite \
php84-pdo_pgsql \
tini
# copy scripts
COPY ./shim.php /usr/local/bin/shim.php
RUN chmod +x /usr/local/bin/shim.php
# run
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/shim.php"]

View file

@ -1,9 +1,9 @@
#!/usr/bin/env php
#!/usr/bin/env php84
<?php /* Copyright (c) 2024 Freya Murphy */
function wait_until_ready() {
while (TRUE) {
if (file_exists("/status/ready")) {
if (file_exists("/var/run/crimson/db-ready")) {
echo "database ready!\n";
break;
}

View file

@ -0,0 +1,32 @@
### XSSBook --- Post posts postfully.
### Copyright © 2024 Freya Murphy <contact@freyacat.org>
###
### This file is part of XSSBook.
###
### CRIMSON is free software; you can redistribute it and/or modify it
### under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 3 of the License, or (at
### your option) any later version.
###
### CRIMSON is distributed in the hope that it will be useful, but
### WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with CRIMSON. If not, see <http://www.gnu.org/licenses/>.
services:
# XSSBook service extensions
# - Adds websocket service
shim:
build: ${PROJECT_ROOT}/build/shim
restart: no
env_file: DOCKER_ENV_FILES
volumes:
- ${PROJECT_ROOT}
- ${PROJECT_DATA}/crimson:/var/run/crimson
depends_on:
postgres:
condition: service_healthy

View file

@ -1,9 +0,0 @@
## shim
TODO: update beacuse this is now invalid :(
If you are runing a xssbook v1 setup, the database is fully incompatible with xssbook v2. Luckily there is a migration that exists to port over your data. XSSBook v1 has a single sqlite database file and a custom assets directory likly called `custom`. You will know you have the right directory if there are two sub directories called `avatar` and `banner`. Place the sqlite db file (called `xssbook.db`) and the `custom` directory in the `data/shim` folder of the xssbook v2 directory. If this doesnt exist please do a full setup of v2 first. Then run `docker compose up -d shim`, and you should be all set.
> WARNING: This will delete ALL data in the database if you specify xssbook v1 files in the data path. Make sure yo only run this once and remove the files once completed.
> NOTE: the migration will never run if the database files are not supplied.

2
site

@ -1 +1 @@
Subproject commit 45b58da72187a7b1ed4d75fc25bf5dd59a86a9c4
Subproject commit d929d8de67edc8881828bddfc817acebaf5d6e80