Add anon-data, dockersetup, start script. User passwords set to test

This commit is contained in:
arttu
2024-06-06 11:56:47 +03:00
parent c24d86a40b
commit 6fac6ab0cb
6 changed files with 4289 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
DATABASE_URL: "mysql://now_test:mariadb_password@nowdb-db-anon:3306/now_test"
SECRET: abcdefg
USER_CREATION_SECRET: abcdefg
NOWDB_BACKEND_PORT: 4000
LOGIN_VALID_MINUTES: 120
BACKEND_MODE: dev
MARIADB_HOST: nowdb-db-anon
MARIADB_ROOT_PASSWORD: admin
MARIADB_DATABASE: now_test
MARIADB_LOG_DATABASE: now_log_test.log
MARIADB_USER: now_test
MARIADB_PASSWORD: mariadb_password
MARIADB_PORT: 3306
+34
View File
@@ -0,0 +1,34 @@
# For running with anonymous data, for e2e tests in local or github actions
services:
frontend:
container_name: nowdb-frontend-dev
image: node:20-alpine3.16
volumes:
- ./frontend/:/usr/src/app
ports:
- 127.0.0.1:5173:5173
command: >
sh -c "cd /usr/src/app && npm ci && npm run dev -- --host"
backend:
container_name: nowdb-backend-dev
image: node:20-alpine3.16
volumes:
- ./backend/:/usr/src/app/backend/
- ./frontend/src/validators:/usr/src/app/frontend/src/validators
ports:
- 127.0.0.1:4000:4000
command: >
sh -c "cd /usr/src/app/backend && npm ci && npm run dev"
env_file: .anon.env
db-anon:
container_name: nowdb-db-anon
image: mariadb
env_file: .anon.env
volumes:
- ./test_data/:/docker-entrypoint-initdb.d
- nowdb-db-anon:/var/lib/mysql/data
ports:
- 127.0.0.1:3306:3306
volumes:
nowdb-db-anon:
+1
View File
@@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"start": "docker compose -f docker-compose.yml up",
"start:anon": "docker compose -f docker-compose.anon.yml up",
"test": "echo \"Error: no test specified\" && exit 1",
"check": "echo \"Running tsc and lint for both services (stops on first error) ...\" && cd frontend && npx tsc --noEmit && npm run lint && cd ../backend && npx tsc --noEmit && npm run lint && echo \"All good! :)\"",
"dev": "docker compose -f docker-compose.dev.yml up",
+12
View File
@@ -0,0 +1,12 @@
DROP DATABASE IF EXISTS now_test; CREATE DATABASE now_test CHARACTER SET latin1;
DROP DATABASE IF EXISTS now_log_test; CREATE DATABASE now_log_test CHARACTER SET latin1;
SET names 'latin1';
USE now_test
SOURCE /docker-entrypoint-initdb.d/sqlfiles/now_anon.sql
USE now_log_test
SOURCE /docker-entrypoint-initdb.d/sqlfiles/now_log_anon.sql
USE now_test
CREATE USER 'now_test'@'localhost' IDENTIFIED BY 'mariadb_password';
GRANT SELECT, INSERT, UPDATE ON `now_log_test`.* TO 'now_test'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE ON `now_test`.* TO 'now_test'@'localhost';
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long