From d5bf22796dc565f9ab855d08b9f6b1912fa64e48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 29 Jun 2024 01:20:25 +0000 Subject: [PATCH 1/4] Bump tsx in /tests in the typescript group across 1 directory Bumps the typescript group with 1 update in the /tests directory: [tsx](https://github.com/privatenumber/tsx). Updates `tsx` from 4.15.6 to 4.15.9 - [Release notes](https://github.com/privatenumber/tsx/releases) - [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs) - [Commits](https://github.com/privatenumber/tsx/compare/v4.15.6...v4.15.9) --- updated-dependencies: - dependency-name: tsx dependency-type: direct:development update-type: version-update:semver-patch dependency-group: typescript ... Signed-off-by: dependabot[bot] --- tests/package-lock.json | 8 ++++---- tests/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/package-lock.json b/tests/package-lock.json index 38c886d439..fef26a77c5 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -31,7 +31,7 @@ "multiple-cucumber-html-reporter": "^3.6.2", "prettier": "^3.3.2", "ts-loader": "^9.5.1", - "tsx": "^4.15.6", + "tsx": "^4.15.9", "typescript": "^5.5.2", "vuepress": "^2.0.0-rc.14", "vuepress-plugin-search-pro": "^2.0.0-rc.50", @@ -15203,9 +15203,9 @@ "dev": true }, "node_modules/tsx": { - "version": "4.15.6", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.15.6.tgz", - "integrity": "sha512-is0VQQlfNZRHEuSSTKA6m4xw74IU4AizmuB6lAYLRt9XtuyeQnyJYexhNZOPCB59SqC4JzmSzPnHGBXxf3k0hA==", + "version": "4.15.9", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.15.9.tgz", + "integrity": "sha512-OEw8VSS5Ug88pj3YhOic1Zmg+mKOuJOcBdpxl402C0D4TjRxu/LTIrr+slbc8nKQA+b7YC9SoHTZAEeQQPBwFw==", "dev": true, "dependencies": { "esbuild": "~0.21.4", diff --git a/tests/package.json b/tests/package.json index 604341f943..e5c8cd82f3 100644 --- a/tests/package.json +++ b/tests/package.json @@ -51,7 +51,7 @@ "multiple-cucumber-html-reporter": "^3.6.2", "prettier": "^3.3.2", "ts-loader": "^9.5.1", - "tsx": "^4.15.6", + "tsx": "^4.15.9", "typescript": "^5.5.2", "vuepress": "^2.0.0-rc.14", "vuepress-plugin-search-pro": "^2.0.0-rc.50", From 682bd91f5e76311fa32d7ade9b243ad26d9e279f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 1 Jul 2024 21:19:54 +0200 Subject: [PATCH 2/4] fix(docs): mismatch in README (#1074) Motivation ---------- Because changing the port numbers would have a side effects on our deployment, I will just fix the typo in the `README.md`. How to test ----------- 1. Compare the README with the `docker-compose.yml` Co-authored-by: Hannes Heine --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c3eb3c181f..26315802e6 100644 --- a/README.md +++ b/README.md @@ -142,10 +142,10 @@ npm run dev | Endpoint | Description | | -------------------------------------------------------------------- | -------------------------- | | [http://localhost:3306](http://localhost:3306) | MySQL Database | -| [http://localhost:3000](http://localhost:3000) | Presenter | +| [http://localhost:3000](http://localhost:3001) | Presenter | | [http://localhost:8081](http://localhost:8081) | Presenter Documentation | | [http://localhost:6006](http://localhost:6006) | Presenter Storybook | -| [http://localhost:3001](http://localhost:3001) | Frontend | +| [http://localhost:3001](http://localhost:3000) | Frontend | | [http://localhost:8082](http://localhost:8082) | Frontend Documentation | | [http://localhost:6007](http://localhost:6007) | Frontend Storybook | | [http://localhost:3002](http://localhost:3002) | Admin | From cdd9e158e200e780d8b79e6db0e36f0d8620f481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 1 Jul 2024 21:32:10 +0200 Subject: [PATCH 3/4] refactor(docker): remove placeholder image names (#1077) Motivation ---------- The `image` in a `docker-compose.yml` is not required. If you want to build the docker image from the `Dockerfile` you can simply add a build context. How to test ----------- 1. `docker image rm` all the dreammall images 2. `docker compose up` 3. All images get rebuilt --- docker-compose.override.yml | 26 +------------------------- docker-compose.yml | 8 -------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 8d91af61a5..329df49624 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -11,8 +11,6 @@ services: # PRESENTER ############################################ ######################################################## presenter: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/presenter:local-development build: target: development ports: @@ -31,8 +29,6 @@ services: # PRESENTER STORYBOOK ################################# ####################################################### presenter-storybook: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/presenter:local-storybook build: context: ./presenter target: storybook @@ -51,8 +47,6 @@ services: # PRESENTER DOCUMENTATION ############################# ####################################################### presenter-documentation: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/presenter:local-documentation build: context: ./presenter target: documentation @@ -71,8 +65,6 @@ services: # FRONTEND ############################################# ######################################################## frontend: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/frontend:local-development build: target: development ports: @@ -92,8 +84,6 @@ services: # FRONTEND STORYBOOK ################################## ####################################################### frontend-storybook: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/frontend:local-storybook build: context: ./frontend target: storybook @@ -112,8 +102,6 @@ services: # FRONTEND DOCUMENTATION ############################## ####################################################### frontend-documentation: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/frontend:local-documentation build: context: ./frontend target: documentation @@ -132,8 +120,6 @@ services: # ADMIN ################################################ ######################################################## admin: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/admin:local-development build: target: development ports: @@ -153,8 +139,6 @@ services: # ADMIN STORYBOOK ##################################### ####################################################### admin-storybook: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/admin:local-storybook build: context: ./admin target: storybook @@ -173,8 +157,6 @@ services: # ADMIN DOCUMENTATION ################################# ####################################################### admin-documentation: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/admin:local-documentation build: context: ./admin target: documentation @@ -193,8 +175,6 @@ services: # BACKEND ############################################# ####################################################### backend: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/backend:local-development build: context: ./backend target: development @@ -211,8 +191,6 @@ services: # BACKEND DOCUMENTATION ############################### ####################################################### backend-documentation: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/backend:local-documentation build: context: ./backend target: documentation @@ -231,8 +209,6 @@ services: # DOCUMENTATION ######################################## ######################################################## documentation: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/dreammall:local-documentation build: target: documentation ports: @@ -258,4 +234,4 @@ volumes: admin_documentation_node_modules: backend_node_modules: backend_documentation_node_modules: - documentation_node_modules: \ No newline at end of file + documentation_node_modules: diff --git a/docker-compose.yml b/docker-compose.yml index 2740e45d30..2479fc13a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,8 +22,6 @@ services: # PRESENTER ############################################ ######################################################## presenter: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/presenter:local-production build: context: ./presenter target: production @@ -39,8 +37,6 @@ services: # FRONTEND ############################################# ######################################################## frontend: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/frontend:local-production build: context: ./frontend target: production @@ -56,8 +52,6 @@ services: # ADMIN ################################################ ######################################################## admin: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: dreammall/admin:local-production build: context: ./admin target: production @@ -73,8 +67,6 @@ services: # BACKEND ############################################# ####################################################### backend: - # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: it4c/backend:local-production build: context: ./backend target: production From e90affd2cd2254ad984e35164ad80cad2657dcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 1 Jul 2024 21:57:57 +0200 Subject: [PATCH 4/4] build(other): test deployment locally (#1272) Context ------- There was a similar PR #1263 attempting to do the same with docker. I was running into isolation issues with docker (setting hostname not allowed in the container and some system folders are read-only) and learned that for this use case, an actual hypervisor would be better and vagrant is a conventional tool to set up these virtual machines. Motivation ---------- On the weekend we had a downtime on production because `nginx` configurations got out of sync with the code in newer releases. To prevent this and further downtimes I suggest to check in our deployment configuration and make it *reproducible*. This PR is an attempt to create a virtual machine that behaves as similar as possible to production and can be used as a sandbox for changes to our deployment configuration. How to test ----------- 1. Install [Vagrant](https://www.vagrantup.com/) on your machine 1. `cd deployment/local-testing` 1. `vagrant up` .. and wait 1. Following services are running: - - - - - 1. Be amazed In the future we might want to use [Ansible](https://www.ansible.com/) for provisioning. We could run our playbooks against this virtual machine, too. --- deployment/local-testing/.gitignore | 1 + deployment/local-testing/README.md | 20 ++++++++++++++ deployment/local-testing/Vagrantfile | 13 +++++++++ deployment/local-testing/bootstrap.sh | 40 +++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 deployment/local-testing/.gitignore create mode 100644 deployment/local-testing/README.md create mode 100644 deployment/local-testing/Vagrantfile create mode 100644 deployment/local-testing/bootstrap.sh diff --git a/deployment/local-testing/.gitignore b/deployment/local-testing/.gitignore new file mode 100644 index 0000000000..8000dd9db4 --- /dev/null +++ b/deployment/local-testing/.gitignore @@ -0,0 +1 @@ +.vagrant diff --git a/deployment/local-testing/README.md b/deployment/local-testing/README.md new file mode 100644 index 0000000000..6e68e2ea18 --- /dev/null +++ b/deployment/local-testing/README.md @@ -0,0 +1,20 @@ +# Local test deployment + +Currently, we're deploying to a vServer. The following will set up virtual machines locally in order to test out the deployment before it hits `staging` or `production`. + +1. Install [Vagrant](https://www.vagrantup.com/) on your machine + +1. `cd deployment/local-testing` + +1. `vagrant up` .. and wait + +1. Following services are running: + - + - + - + - + - + +1. Be amazed + +In the future we might want to use [Ansible](https://www.ansible.com/) for provisioning. We could run our playbooks against this virtual machine, too. diff --git a/deployment/local-testing/Vagrantfile b/deployment/local-testing/Vagrantfile new file mode 100644 index 0000000000..349567b55a --- /dev/null +++ b/deployment/local-testing/Vagrantfile @@ -0,0 +1,13 @@ +# Defines our Vagrant environment +# +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = 'generic/alpine319' + config.vm.provision :shell, path: "bootstrap.sh" + config.vm.synced_folder '.', '/vagrant', disabled: true + config.vm.network "forwarded_port", guest: 80, host: 8000 + config.vm.network "forwarded_port", guest: 8080, host: 8080 + config.vm.network "forwarded_port", guest: 8082, host: 8082 +end diff --git a/deployment/local-testing/bootstrap.sh b/deployment/local-testing/bootstrap.sh new file mode 100644 index 0000000000..680640e91b --- /dev/null +++ b/deployment/local-testing/bootstrap.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +apk update +apk upgrade +apk add nginx openrc nodejs npm git mysql mysql-client + + +npm install pm2 -g +pm2 startup + +rc-update add pm2 boot +rc-update add nginx boot +service nginx start + + +service mariadb setup +rc-update add mariadb boot +sed -e '/skip-networking/ s/^#*/#/' -i /etc/my.cnf.d/mariadb-server.cnf +service mariadb start + + +cd /var/www/localhost/htdocs/ +git clone https://github.com/dreammall-earth/dreammall.earth.git +cd dreammall.earth + +mkdir -p /etc/nginx/http.d +cp -f ./deployment/nginx/default.conf /etc/nginx/http.d/default.conf +cp ./deployment/nginx/frontend.conf /etc/nginx/http.d/frontend.conf +cp ./deployment/nginx/admin.conf /etc/nginx/http.d/admin.conf + +service nginx restart + +mysql -e "CREATE USER 'dreammall'@'localhost' IDENTIFIED BY 'SECRET'; GRANT ALL PRIVILEGES ON * . * TO 'dreammall'@'localhost'; FLUSH PRIVILEGES;" + +cp backend/.env.dist backend/.env +cp presenter/.env.dist presenter/.env +cp frontend/.env.dist frontend/.env +cp admin/.env.dist admin/.env + +deployment/deploy.sh