add nextjs app: yoga-app

This commit is contained in:
Schneider Roland
2025-01-06 22:13:54 +01:00
parent 72681846d8
commit bed409f77c
283 changed files with 11753 additions and 331 deletions

View File

@@ -0,0 +1,54 @@
# Building the docker image
## Dockerfile
The Dockerfile can be found in the root folder of the project.
## Available Environment Variables
| property name | description | values |
|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| DB_TYPE | type of the db enginge. | mysql, h2 |
| DB_URL | jdbc url of the db | "jdbc:mysql://ucs-intranet-db-author:3306/magnolia" |
| DB_USER | username for the db | root |
| DB_PASSWORD | password for the db | root |
| CATALINA_OPTS_APPEND | Java options form tomcat | "-Xms512M -Xmx2048M " |
| JAVA_OPTS | addition java options for application | "-agentlib:jdwp=transport=dt_socket,address=*:54455,server=y,suspend=n" |
| MAGNOLIA_UPDATE_AUTO | set the property 'magnolia.update.auto' in magnolia.properties | ${MAGNOLIA_UPDATE_AUTO} |
| MAGNOLIA_AUTHORINSTANCE_URL | public accessible url of the author instance | http://author.ucsintranet.at |
| MAGNOLIA_UCSWEBSITE_AUTHORINSTANCE_URL | public accessible url of the author instance of the UCS website | http://author.ucsintranet.at |
| MAGNOLIA_PUBLICINSTANCE_URL | public accessible url of the public instance | http://public.ucsintranet.at |
| MAGNOLIA_PROFILE | the magnolia profile to use (see: https://docs.magnolia-cms.com/product-docs/6.2/releases/release-notes-for-magnolia-cms-6.2.2/#_profile_based_configuration_of_property_files) | magnoliaAuthor, magnoliaPublic |
| KEYCLOAK_REALM | the keycloak realm to use | magnolia |
| KEYCLOAK_CLIENT_ID_AUTHOR | the author keycloak client id | author.ucsintranet |
| KEYCLOAK_CLIENT_ID_PUBLIC | the author keycloak client id | author.ucsintranet |
| KEYCLOAK_AUTH_URL | <TBD> | ${KEYCLOAK_AUTH_URL} |
| KEYCLOAK_SSL_REQUIRED | <TBD> | external |
| KEYCLOAK_CREDENTIALS_SECRET_AUTHOR | author keycloak secret | |
| KEYCLOAK_CREDENTIALS_SECRET_PUBLIC | public keycloak secret | |
## About the image
The image is based on the cli provided by magnolia ( a.k.a mgnl).
To get more information about the mgnl cli tool, please visit the [mgnl documentation](https://docs.magnolia-cms.com/magnolia-cli/4.x/)
The project generated by the mgnl tool, already includes the author and public instances!
Be sure, that in production you restrict the access to the author instance, and to the admin components
The image is set up so, that it uses the folder "/magnolia/light-modules" as resources dir.
While build the image, the <PROJECT_ROOT>/magnolia/modules will be copied in to the image as "/magnolia/light-modules".
For development, the <PROJECT_ROOT>/magnolia/modules can be mounted, so the changes in the lightmodules are "live/instant"
## Building & pushing the image
The easiest way to build and pusht the image is, to run the next commands
```bash
npm run docker:build
```
```bash
npm run docker:push
```
For more details, pls examine the package.json file, and the scripts in docker/magnolia/scripts folder

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
source "${CURRENT_DIR}/build.docker.build.step.inc.version.sh"
source "${CURRENT_DIR}/build.docker.build.step.build.sh"

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
# build docker image
source "${CURRENT_DIR}/build.docker.env.sh"
PROJECT_ROOT=$(readlink -f "${CURRENT_DIR}/../../../../..")
echo "build image ${TAG} from folder ${PROJECT_ROOT}"
cd $PROJECT_ROOT
docker build --platform linux/amd64 -t $TAG .

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# set the actual commit date and commit hash in version.txt
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_BRANCH_SHORT=$(echo $GIT_BRANCH | cut -d "/" -f 1)
GIT_COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y%m%d%H%M)
GIT_COMMIT_ID_SHORT=$(git rev-parse --short HEAD)
VERSION=$GIT_COMMIT_DATE.$GIT_COMMIT_ID_SHORT
CURRENT_DIR=$(dirname "$0")
VERSION_FILE="${CURRENT_DIR}/version.txt"
echo "Saving version ${VERSION} to file ${VERSION_FILE}"
echo $VERSION
echo $VERSION > $VERSION_FILE

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
VERSION_FILE="${CURRENT_DIR}/version.txt"
echo "Reading version file: ${VERSION_FILE}"
export VERSION=$(cat "${VERSION_FILE}")
export TAG=docker.rschneider.hu/infra/yoga-strapi:$VERSION

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
# push docker image
source "${CURRENT_DIR}/build.docker.env.sh"
echo "push image ${TAG}"
docker push $TAG

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
source "${CURRENT_DIR}/build.docker.env.sh"
source "${CURRENT_DIR}/start.docker.env.sh"
cd ${ENV_DEV_DIR}
docker-compose down

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
ENV_DEV_DIR=$(readlink -f "${CURRENT_DIR}/../../../environments/dev/docker-compose")
COMPOSE_FILE=$(readlink -f "/docker-compose.yml")

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
source "${CURRENT_DIR}/start.docker.compose.env.sh"
cd "${ENV_DEV_DIR}"
echo "starting compose file in ${ENV_DEV_DIR}"
docker compose up -d

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
source "${CURRENT_DIR}/build.docker.env.sh"
source "${CURRENT_DIR}/start.docker.compose.env.sh"
echo "updating image version to ${VERSION} in compose file ${COMPOSE_FILE}"
#export TAG=docker.rschneider.hu/infra/yogastic:$VERSION
case $(uname) in
"Darwin")
echo "Detected macOS"
sed -i'' -e "s/docker.rschneider.hu\\/infra\\/yogastic:.*/docker.rschneider.hu\\/infra\\/yogastic:$VERSION/g" $COMPOSE_FILE
;;
*)
sed -i "s/docker.rschneider.hu\\/infra\\/yogastic:.*/docker.rschneider.hu\\/infra\\/yogastic:$VERSION/g" $COMPOSE_FILE
#sed -i "s/docker.rschneider.hu\\/infra\\/yogastic:.*/docker.rschneider.hu\\/infra\\/yogastic:$VERSION/g" $COMPOSE_FILE
;;
esac

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
source "${CURRENT_DIR}/build.docker.env.sh"
source "${CURRENT_DIR}/start.docker.compose.env.sh"
cd ${ENV_DEV_DIR}
echo "Destroy compose in ${ENV_DEV_DIR}"
docker compose down -v

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
CURRENT_DIR=$(dirname "$0")
source "${CURRENT_DIR}/build.docker.env.sh"
source "${CURRENT_DIR}/start.docker.compose.env.sh"
cd ${ENV_DEV_DIR}
echo "Stopping compose in ${ENV_DEV_DIR}"
docker compose down

View File

@@ -0,0 +1 @@
202412302206.7268184