diff --git a/.config/ci.yml b/.config/ci.yml index d20ede8d35..0c78a7f66d 100644 --- a/.config/ci.yml +++ b/.config/ci.yml @@ -6,7 +6,7 @@ #───┘ URL └───────────────────────────────────────────────────── # Final accessible URL seen by a user. -url: http://misskey.local +url: http://127.0.0.1:3000 # ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE # URL SETTINGS AFTER THAT! @@ -221,9 +221,10 @@ checkActivityPubGetSignature: false # For security reasons, uploading attachments from the intranet is prohibited, # but exceptions can be made from the following settings. Default value is "undefined". # Read changelog to learn more (Improvements of 12.90.0 (2021/09/04)). -#allowedPrivateNetworks: [ -# '127.0.0.1/32' -#] +allowedPrivateNetworks: [ + '127.0.0.1/32', + '192.168.65.0/24' +] #customMOTD: ['Hello World', 'The sharks rule all', 'Shonks'] diff --git a/compose.local-dev.yml b/compose.local-dev.yml new file mode 100644 index 0000000000..17f4f91a6b --- /dev/null +++ b/compose.local-dev.yml @@ -0,0 +1,51 @@ +# このconfigは、 dockerでMisskey本体を起動せず、 redisとpostgresql などだけを起動します +name: barkey-devcontainer +services: + redis: + restart: always + image: redis:7-alpine + ports: + - "6379:6379" + volumes: + - ./redis:/data + healthcheck: + test: "redis-cli ping" + interval: 5s + retries: 20 + + postgres: + restart: always + image: postgres:15-alpine + ports: + - "5432:5432" + env_file: + - .config/docker.env + volumes: + - ./db:/var/lib/postgresql/data + healthcheck: + test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" + interval: 5s + retries: 20 + + web: + restart: always + image: node:iron + ports: + - 3000:3000 + - 5173:5173 + working_dir: /host + volumes: + - ./:/host + command: sleep infinity + +# meilisearch: +# restart: always +# image: getmeili/meilisearch:v1.3.4 +# environment: +# - MEILI_NO_ANALYTICS=true +# - MEILI_ENV=production +# env_file: +# - .config/meilisearch.env +# volumes: +# - ./meili_data:/meili_data + diff --git a/compose.local-test.yml b/compose.local-test.yml index ecb9f42722..0a1f4f541f 100644 --- a/compose.local-test.yml +++ b/compose.local-test.yml @@ -1,13 +1,11 @@ # このconfigは、 dockerでMisskey本体を起動せず、 redisとpostgresql などだけを起動します - +name: barkey-test services: redis: restart: always image: redis:7-alpine ports: - "6379:6379" - volumes: - - ./redis:/data healthcheck: test: "redis-cli ping" interval: 5s @@ -20,8 +18,6 @@ services: - "5432:5432" env_file: - .config/docker.env - volumes: - - ./db:/var/lib/postgresql/data healthcheck: test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" interval: 5s @@ -32,6 +28,7 @@ services: image: node:iron ports: - 3000:3000 + working_dir: /host volumes: - ./:/host command: sleep infinity diff --git a/packages/frontend/vite.config.local-dev.ts b/packages/frontend/vite.config.local-dev.ts index d588f83138..c8e07b57ef 100644 --- a/packages/frontend/vite.config.local-dev.ts +++ b/packages/frontend/vite.config.local-dev.ts @@ -32,7 +32,7 @@ const devConfig: UserConfig = { publicDir: '../assets', base: './', server: { - host: 'localhost', + host: '0.0.0.0', port: 5173, proxy: { '/api': { diff --git a/setup-dev.sh b/setup-dev.sh new file mode 100755 index 0000000000..945e3dd8cb --- /dev/null +++ b/setup-dev.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +read -p "Reset databases? [y/N] " cleardb + +case $cleardb in + [Yy] ) + echo "Clearning postgres..." + rm -rf ./db + sleep 1 + echo "Clearing redis..." + rm -rf ./redis + sleep 1 + ;; + * ) + ;; +esac + +cp .config/ci.yml .config/default.yml +cp .config/ci.yml .config/test.yml +cp .config/docker_ci.env .config/docker.env +cp compose.local-dev.yml compose.yml + +echo Creating environment... +docker compose up -d +docker compose exec web apt-get update +docker compose exec web apt-get install -y bash + +echo Installing dependencies... +docker compose exec web apt-get install -y git wget curl build-essential python3 ffmpeg +docker compose exec web corepack enable +docker compose exec web corepack prepare pnpm@latest --activate +docker compose exec web git submodule update --init +docker compose exec web pnpm install --frozen-lockfile + +echo Environment is ready. +echo 5173 for dev, and 3000 for prod. +echo Do not forget to \`pnpm migrate\` before your first launch! +docker compose exec web bash + +echo Stopping containers... +docker compose stop +rm -f compose.yml diff --git a/setup-tests.sh b/setup-tests.sh index 11da60c844..e116a526be 100755 --- a/setup-tests.sh +++ b/setup-tests.sh @@ -1,9 +1,8 @@ #!/bin/bash -echo "This script will destroy the following local directories:" +echo "During testing, your local postgres and redis databases will not be touched." +echo "This script will remove the build directories in the following locations:" echo " ./built" -echo " ./db" -echo " ./redis" echo echo "Do you want to continue? [Y/n]" read -p "> " confirmation @@ -29,7 +28,7 @@ docker compose rm echo Removing any preexisting builds and databases. echo This may take a few moments... -rm -rf ./built ./db ./redis +rm -rf ./built echo Creating environment docker compose up -d diff --git a/tests.sh b/tests.sh index 5df78f4c76..81c4631281 100755 --- a/tests.sh +++ b/tests.sh @@ -4,7 +4,6 @@ set -e -cd /host/ apt-get update && apt-get install -y git wget curl build-essential python3 ffmpeg corepack enable corepack prepare pnpm@latest --activate