mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
wip fixed issues with container start ups
This commit is contained in:
parent
c615d652ac
commit
201883d987
@ -1,12 +1,12 @@
|
||||
FROM docker.io/spiralscout/roadrunner:2.12.2 as roadrunner
|
||||
FROM docker.io/composer:2.5.1 as composer
|
||||
FROM docker.io/mlocati/php-extension-installer:1.5.52 as php-ext-installer
|
||||
FROM docker.io/mlocati/php-extension-installer:2.1.58 as php-ext-installer
|
||||
FROM php:8.1.16-bullseye
|
||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||
COPY --from=php-ext-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||
ENV COMPOSER_HOME="/tmp/composer"
|
||||
RUN set -x \
|
||||
&& install-php-extensions intl bz2 gettext mongodb-stable redis opcache sockets pcntl \
|
||||
&& install-php-extensions intl mbstring mongodb-stable redis opcache sockets pcntl \
|
||||
# install xdebug (for testing with code coverage), but do not enable it
|
||||
&& IPE_DONT_ENABLE=1 install-php-extensions xdebug-3.2.0
|
||||
|
||||
@ -17,9 +17,8 @@ RUN set -ex \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssl \
|
||||
git \
|
||||
dos2unix \
|
||||
unzip \
|
||||
wget \
|
||||
unzip \
|
||||
# install supercronic (for laravel task scheduling), project page: <https://github.com/aptible/supercronic>
|
||||
&& wget -q "https://github.com/aptible/supercronic/releases/download/v0.1.12/supercronic-linux-$(dpkg --print-architecture)" \
|
||||
-O /usr/bin/supercronic \
|
||||
|
@ -21,6 +21,7 @@ display_help() {
|
||||
echo "help Print CLI help"
|
||||
echo "build-image Build Image Locally"
|
||||
echo "start Start Jikan API (mongodb, typesense, redis, jikan-api workers)"
|
||||
echo "stop Stop Jikan API"
|
||||
echo "validate-prereqs Validate pre-reqs installed (docker, docker-compose)"
|
||||
echo "execute-indexers Execute the indexers, which will scrape and index data from MAL. (Notice: This can take days)"
|
||||
echo ""
|
||||
@ -69,6 +70,7 @@ validate_prereqs() {
|
||||
|
||||
build_image() {
|
||||
validate_prereqs
|
||||
$DOCKER_CMD inspect jikanme/jikan-rest:"$_JIKAN_API_VERSION" &> /dev/null && $DOCKER_CMD rmi jikanme/jikan-rest:"$_JIKAN_API_VERSION"
|
||||
$DOCKER_CMD build --rm --compress -t jikanme/jikan-rest:"$_JIKAN_API_VERSION" .
|
||||
$DOCKER_CMD tag jikanme/jikan-rest:"$_JIKAN_API_VERSION" jikanme/jikan-rest:latest
|
||||
}
|
||||
|
@ -39,6 +39,10 @@ services:
|
||||
test: [ 'CMD-SHELL', 'wget --spider -q "http://127.0.0.1:2114/health?plugin=http"' ]
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
links:
|
||||
- mongodb
|
||||
- redis
|
||||
- typesense
|
||||
depends_on:
|
||||
mongodb: { condition: service_healthy }
|
||||
redis: { condition: service_healthy }
|
||||
@ -51,7 +55,7 @@ services:
|
||||
- mongo-data:/data/db
|
||||
ports:
|
||||
- '27017/tcp'
|
||||
command: "--wiredTigerCacheSizeGB ${MONGO_CACHE_SIZE_GB:1}"
|
||||
command: "--wiredTigerCacheSizeGB ${MONGO_CACHE_SIZE_GB:-1.0}"
|
||||
networks:
|
||||
- jikan_network
|
||||
secrets:
|
||||
@ -61,18 +65,16 @@ services:
|
||||
MONGO_INITDB_ROOT_USERNAME_FILE: /run/secrets/db_username
|
||||
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
||||
healthcheck:
|
||||
test: echo 'db.runCommand("ping").ok' | mongo mongodb://localhost:27017 --quiet
|
||||
test: echo 'db.runCommand("ping").ok' | mongosh mongodb://localhost:27017 --quiet
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: docker.io/redis:7-alpine
|
||||
image: docker.io/redis:6-alpine
|
||||
hostname: redis
|
||||
secrets:
|
||||
- redis_password
|
||||
environment:
|
||||
REDIS_PASSWORD: "${REDIS_PASSWORD:-null}"
|
||||
networks:
|
||||
- jikan_network
|
||||
command:
|
||||
@ -99,7 +101,9 @@ services:
|
||||
command:
|
||||
- -c
|
||||
- TYPESENSE_API_KEY="$$(cat /run/secrets/typesense_api_key)" /opt/typesense-server --data-dir /data
|
||||
restart: no
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: none
|
||||
volumes:
|
||||
- typesense-data:/data
|
||||
ports:
|
||||
|
@ -37,7 +37,6 @@ if (!file_exists(".env")) {
|
||||
$envWriter = new \MirazMac\DotEnv\Writer(__DIR__ . '/' . '.env');
|
||||
$itemsWritten = 0;
|
||||
foreach (array_keys($current_env) as $env_key) {
|
||||
echo $env_key;
|
||||
if (!str_contains($env_key, "__FILE")) {
|
||||
continue;
|
||||
}
|
||||
@ -52,12 +51,14 @@ foreach (array_keys($current_env) as $env_key) {
|
||||
|
||||
if ($itemsWritten > 0) {
|
||||
$envWriter->write();
|
||||
echo "Secrets loaded successfully.";
|
||||
echo "Secrets loaded successfully.\n";
|
||||
}
|
||||
|
||||
$dotenv = Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->load();
|
||||
|
||||
$current_env = $_ENV;
|
||||
|
||||
if ($current_env["SCOUT_DRIVER"] === "typesense" && empty($current_env["TYPESENSE_API_KEY"])) {
|
||||
echo "Please set the TYPESENSE_API_KEY environment variable when setting SCOUT_DRIVER to typesense.";
|
||||
exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user