From 6fe8b15f00caf54cc70e1eb50676c8c03182061e Mon Sep 17 00:00:00 2001
From: Konstantin Schulz <schulzkx@hu-berlin.de>
Date: Tue, 24 Oct 2023 13:23:58 +0200
Subject: [PATCH] fix env file setup on first install

---
 .gitlab-ci.yml                                 | 3 ++-
 README.md                                      | 4 ++--
 deploy.sh                                      | 5 -----
 mc_frontend/package.json                       | 2 +-
 scripts/copy_env_file.sh                       | 2 ++
 coverage_ci.sh => scripts/coverage_ci.sh       | 0
 coverage_local.sh => scripts/coverage_local.sh | 0
 scripts/deploy.sh                              | 4 ++++
 8 files changed, 11 insertions(+), 9 deletions(-)
 delete mode 100755 deploy.sh
 create mode 100755 scripts/copy_env_file.sh
 rename coverage_ci.sh => scripts/coverage_ci.sh (100%)
 rename coverage_local.sh => scripts/coverage_local.sh (100%)
 create mode 100755 scripts/deploy.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ba5dc24..d76b5a7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,6 +16,7 @@ build:
     - docker:24.0.5-dind
   stage: build
   script:
+    - ./scripts/copy_env_file.sh
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
     - docker compose build mcserver
     - docker compose push mcserver
@@ -50,6 +51,6 @@ coverage:
     when: always
   stage: coverage
   script:
-    - ./coverage_ci.sh
+    - ./scripts/coverage_ci.sh
     - cat coverage.log
   coverage: '/Statements.*?(\d+(?:\.\d+)?)%/'
diff --git a/README.md b/README.md
index c2dbd03..6a756ed 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
    `git clone https://scm.cms.hu-berlin.de/callidus/machina-callida.git`.
 3. Move to the newly created folder:
    `cd machina-callida`.
-4. Run `./deploy.sh`.
+4. Run `./scripts/deploy.sh`.
 
    When using the application for the first time, it may take a few minutes until the container "mc_frontend" has
    finished compiling the application.
@@ -66,7 +66,7 @@ To update the changelog, use: `git log --oneline --decorate > CHANGELOG`
 
 ### Locally
 
-To test your code locally, run `./coverage_local.sh` (all components)
+To test your code locally, run `./scripts/coverage_local.sh` (all components)
 or `docker compose run --rm --entrypoint="./coverage_backend.sh" mcserver` (only backend).
 
 To test the GitLab CI locally, run `gitlab-runner exec docker --docker-privileged JOB_NAME`.
diff --git a/deploy.sh b/deploy.sh
deleted file mode 100755
index 9e67a66..0000000
--- a/deploy.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# rename the template environment file and ignore errors if it does not exist (e.g., because it was already renamed)
-mv ./mc_backend/mcserver/template.env ./mc_backend/mcserver/.env 2>/dev/null
-docker compose build
-docker compose down
-docker compose up -d
diff --git a/mc_frontend/package.json b/mc_frontend/package.json
index bb1498f..e143c87 100644
--- a/mc_frontend/package.json
+++ b/mc_frontend/package.json
@@ -1,6 +1,6 @@
 {
   "name": "mc_frontend",
-  "version": "2.8.1",
+  "version": "2.8.2",
   "author": "Ionic Framework",
   "homepage": "https://ionicframework.com/",
   "scripts": {
diff --git a/scripts/copy_env_file.sh b/scripts/copy_env_file.sh
new file mode 100755
index 0000000..b643cfd
--- /dev/null
+++ b/scripts/copy_env_file.sh
@@ -0,0 +1,2 @@
+# rename the template environment file and ignore errors if it does not exist (e.g., because it was already renamed)
+cp -u ./mc_backend/mcserver/template.env ./mc_backend/mcserver/.env 2>/dev/null
diff --git a/coverage_ci.sh b/scripts/coverage_ci.sh
similarity index 100%
rename from coverage_ci.sh
rename to scripts/coverage_ci.sh
diff --git a/coverage_local.sh b/scripts/coverage_local.sh
similarity index 100%
rename from coverage_local.sh
rename to scripts/coverage_local.sh
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
new file mode 100755
index 0000000..bcbd5cf
--- /dev/null
+++ b/scripts/deploy.sh
@@ -0,0 +1,4 @@
+./scripts/copy_env_file.sh
+docker compose build
+docker compose down
+docker compose up -d
-- 
GitLab