mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-01 05:54:12 +00:00 
			
		
		
		
	Merge pull request 'Test environment revision and dev environment implementation' (#33) from 31-revise-local-test-suite-and-create-local-dev-container into dev
Reviewed-on: https://codeberg.org/yeentown/barkey/pulls/33 Closes #31
This commit is contained in:
		
						commit
						db7f94dd69
					
				
					 7 changed files with 104 additions and 15 deletions
				
			
		|  | @ -6,7 +6,7 @@ | ||||||
| #───┘ URL └───────────────────────────────────────────────────── | #───┘ URL └───────────────────────────────────────────────────── | ||||||
| 
 | 
 | ||||||
| # Final accessible URL seen by a user. | # 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 | # ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE | ||||||
| # URL SETTINGS AFTER THAT! | # URL SETTINGS AFTER THAT! | ||||||
|  | @ -221,9 +221,10 @@ checkActivityPubGetSignature: false | ||||||
| # For security reasons, uploading attachments from the intranet is prohibited, | # For security reasons, uploading attachments from the intranet is prohibited, | ||||||
| # but exceptions can be made from the following settings. Default value is "undefined". | # 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)). | # Read changelog to learn more (Improvements of 12.90.0 (2021/09/04)). | ||||||
| #allowedPrivateNetworks: [ | allowedPrivateNetworks: [ | ||||||
| #  '127.0.0.1/32' |   '127.0.0.1/32', | ||||||
| #] |   '192.168.65.0/24' | ||||||
|  | ] | ||||||
| 
 | 
 | ||||||
| #customMOTD: ['Hello World', 'The sharks rule all', 'Shonks'] | #customMOTD: ['Hello World', 'The sharks rule all', 'Shonks'] | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										51
									
								
								compose.local-dev.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								compose.local-dev.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -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 | ||||||
|  | 
 | ||||||
|  | @ -1,13 +1,11 @@ | ||||||
| # このconfigは、 dockerでMisskey本体を起動せず、 redisとpostgresql などだけを起動します | # このconfigは、 dockerでMisskey本体を起動せず、 redisとpostgresql などだけを起動します | ||||||
| 
 | name: barkey-test | ||||||
| services: | services: | ||||||
|   redis: |   redis: | ||||||
|     restart: always |     restart: always | ||||||
|     image: redis:7-alpine |     image: redis:7-alpine | ||||||
|     ports: |     ports: | ||||||
|       - "6379:6379" |       - "6379:6379" | ||||||
|     volumes: |  | ||||||
|       - ./redis:/data |  | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: "redis-cli ping" |       test: "redis-cli ping" | ||||||
|       interval: 5s |       interval: 5s | ||||||
|  | @ -20,8 +18,6 @@ services: | ||||||
|       - "5432:5432" |       - "5432:5432" | ||||||
|     env_file: |     env_file: | ||||||
|       - .config/docker.env |       - .config/docker.env | ||||||
|     volumes: |  | ||||||
|       - ./db:/var/lib/postgresql/data |  | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" |       test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" | ||||||
|       interval: 5s |       interval: 5s | ||||||
|  | @ -32,6 +28,7 @@ services: | ||||||
|     image: node:iron |     image: node:iron | ||||||
|     ports: |     ports: | ||||||
|       - 3000:3000 |       - 3000:3000 | ||||||
|  |     working_dir: /host | ||||||
|     volumes: |     volumes: | ||||||
|       - ./:/host |       - ./:/host | ||||||
|     command: sleep infinity |     command: sleep infinity | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ const devConfig: UserConfig = { | ||||||
| 	publicDir: '../assets', | 	publicDir: '../assets', | ||||||
| 	base: './', | 	base: './', | ||||||
| 	server: { | 	server: { | ||||||
| 		host: 'localhost', | 		host: '0.0.0.0', | ||||||
| 		port: 5173, | 		port: 5173, | ||||||
| 		proxy: { | 		proxy: { | ||||||
| 			'/api': { | 			'/api': { | ||||||
|  |  | ||||||
							
								
								
									
										42
									
								
								setup-dev.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								setup-dev.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -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 | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| #!/bin/bash | #!/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 "  ./built" | ||||||
| echo "  ./db" |  | ||||||
| echo "  ./redis" |  | ||||||
| echo | echo | ||||||
| echo "Do you want to continue? [Y/n]" | echo "Do you want to continue? [Y/n]" | ||||||
| read -p "> " confirmation | read -p "> " confirmation | ||||||
|  | @ -29,7 +28,7 @@ docker compose rm | ||||||
| 
 | 
 | ||||||
| echo Removing any preexisting builds and databases. | echo Removing any preexisting builds and databases. | ||||||
| echo This may take a few moments... | echo This may take a few moments... | ||||||
| rm -rf ./built ./db ./redis | rm -rf ./built | ||||||
| 
 | 
 | ||||||
| echo Creating environment | echo Creating environment | ||||||
| docker compose up -d | docker compose up -d | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								tests.sh
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								tests.sh
									
										
									
									
									
								
							|  | @ -4,7 +4,6 @@ | ||||||
| 
 | 
 | ||||||
| set -e | set -e | ||||||
| 
 | 
 | ||||||
| cd /host/ |  | ||||||
| apt-get update && apt-get install -y git wget curl build-essential python3 ffmpeg | apt-get update && apt-get install -y git wget curl build-essential python3 ffmpeg | ||||||
| corepack enable | corepack enable | ||||||
| corepack prepare pnpm@latest --activate | corepack prepare pnpm@latest --activate | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue