diff --git a/client/src/pages/catalogue/api/loader.ts b/client/src/pages/catalogue/api/loader.ts index 8ec9c314..5dd467a8 100644 --- a/client/src/pages/catalogue/api/loader.ts +++ b/client/src/pages/catalogue/api/loader.ts @@ -5,9 +5,10 @@ import { CATALOGUE_DEFAULT_PAGE_NUMBER, CATALOGUE_DEFAULT_PAGE_SIZE, } from "shared/config/frontend"; +import { apiConfig } from "shared/config/api"; const getInstrumentsByCriteriaPaginated = - new GetInstrumentsByCriteriaPaginatedApi(); + new GetInstrumentsByCriteriaPaginatedApi(apiConfig); export interface CatalogueLoader { instrumentPage: GetInstrumentByCriteriaPageResponse; diff --git a/client/src/pages/catalogue/ui/Catalogue.page.tsx b/client/src/pages/catalogue/ui/Catalogue.page.tsx index b8c9644c..cae3b7d8 100644 --- a/client/src/pages/catalogue/ui/Catalogue.page.tsx +++ b/client/src/pages/catalogue/ui/Catalogue.page.tsx @@ -12,9 +12,10 @@ import { CatalogueLoader } from "pages/catalogue"; import { NavigationBarWidget } from "widgets/catalogue-navbar"; import { SearchBarInputField } from "pages/catalogue/ui/SearchBarInput.field"; import { useDarkMode } from "shared/dark-mode/use-dark-mode"; +import { apiConfig } from "shared/config/api"; const getInstrumentsByCriteriaPaginated = - new GetInstrumentsByCriteriaPaginatedApi(); + new GetInstrumentsByCriteriaPaginatedApi(apiConfig); export function CataloguePage() { const { darkMode } = useDarkMode(); diff --git a/client/src/pages/create-instrument/api/action.ts b/client/src/pages/create-instrument/api/action.ts index 6e8153a0..79b7cb1a 100644 --- a/client/src/pages/create-instrument/api/action.ts +++ b/client/src/pages/create-instrument/api/action.ts @@ -2,12 +2,13 @@ import { ActionFunction } from "react-router-dom"; import Jwt from "domain/model/jwt"; import { CreateInstrumentApi } from "generated/api/create-instrument-api"; import { parseInstrumentDetails } from "shared/model"; +import { apiConfig } from "shared/config/api"; export interface CreateInstrumentAction { errors: string[] | null; } -const createInstrument = new CreateInstrumentApi(); +const createInstrument = new CreateInstrumentApi(apiConfig); export const action: ActionFunction = async ({ request, diff --git a/client/src/pages/create-instrument/api/loader.ts b/client/src/pages/create-instrument/api/loader.ts index 2b3b6db9..5cf03cba 100644 --- a/client/src/pages/create-instrument/api/loader.ts +++ b/client/src/pages/create-instrument/api/loader.ts @@ -9,11 +9,12 @@ import type { import { GetInstrumentBasicMaterialsApi } from "generated/api/get-instrument-basic-materials-api"; import { GetCountriesApi } from "generated/api"; import { GetManufacturersApi } from "generated/api"; +import { apiConfig } from "shared/config/api"; -const getInstrumentTypes = new GetInstrumentTypesApi(); -const getInstrumentBasicMaterials = new GetInstrumentBasicMaterialsApi(); -const getCountries = new GetCountriesApi(); -const getManufacturers = new GetManufacturersApi(); +const getInstrumentTypes = new GetInstrumentTypesApi(apiConfig); +const getInstrumentBasicMaterials = new GetInstrumentBasicMaterialsApi(apiConfig); +const getCountries = new GetCountriesApi(apiConfig); +const getManufacturers = new GetManufacturersApi(apiConfig); export interface CreateInstrumentLoader { instrumentTypes: InstrumentType[]; diff --git a/client/src/pages/edit-instrument/api/action.ts b/client/src/pages/edit-instrument/api/action.ts index 0396a095..76319d76 100644 --- a/client/src/pages/edit-instrument/api/action.ts +++ b/client/src/pages/edit-instrument/api/action.ts @@ -2,12 +2,13 @@ import { ActionFunction } from "react-router-dom"; import Jwt from "domain/model/jwt"; import { EditInstrumentApi } from "generated/api/edit-instrument-api"; import { parseInstrumentDetails } from "shared/model"; +import { apiConfig } from "shared/config/api"; export interface EditInstrumentAction { errors: string[]; } -const editInstrument = new EditInstrumentApi(); +const editInstrument = new EditInstrumentApi(apiConfig); export const action: ActionFunction = async ({ request, diff --git a/client/src/pages/edit-instrument/api/loader.ts b/client/src/pages/edit-instrument/api/loader.ts index ef6fc928..ae466ccd 100644 --- a/client/src/pages/edit-instrument/api/loader.ts +++ b/client/src/pages/edit-instrument/api/loader.ts @@ -13,13 +13,14 @@ import { GetInstrumentBasicMaterialsApi } from "generated/api/get-instrument-bas import { GetCountriesApi } from "generated/api/get-countries-api"; import { GetManufacturersApi } from "generated/api/get-manufacturers-api"; import { GetInstrumentPhotoApi } from "generated/api/get-instrument-photo-api"; +import { apiConfig } from "shared/config/api"; -const getInstrumentById = new GetInstrumentByIdApi(); -const getInstrumentTypes = new GetInstrumentTypesApi(); -const getInstrumentBasicMaterials = new GetInstrumentBasicMaterialsApi(); -const getCountries = new GetCountriesApi(); -const getManufacturers = new GetManufacturersApi(); -const getInstrumentPhoto = new GetInstrumentPhotoApi(); +const getInstrumentById = new GetInstrumentByIdApi(apiConfig); +const getInstrumentTypes = new GetInstrumentTypesApi(apiConfig); +const getInstrumentBasicMaterials = new GetInstrumentBasicMaterialsApi(apiConfig); +const getCountries = new GetCountriesApi(apiConfig); +const getManufacturers = new GetManufacturersApi(apiConfig); +const getInstrumentPhoto = new GetInstrumentPhotoApi(apiConfig); export interface EditInstrumentLoader { instrumentForEdit: InstrumentDetail; diff --git a/client/src/pages/favorite/api/loader.ts b/client/src/pages/favorite/api/loader.ts index b9b924c6..846b0567 100644 --- a/client/src/pages/favorite/api/loader.ts +++ b/client/src/pages/favorite/api/loader.ts @@ -3,12 +3,13 @@ import { InstrumentDetail } from "generated/model"; import { ListFavoriteApi } from "generated/api/list-favorite-api"; import Jwt from "domain/model/jwt"; import { LOGIN } from "shared/config/paths"; +import { apiConfig } from "shared/config/api"; export interface FavoriteLoader { instrumentDetails: InstrumentDetail[]; } -const listFavorite = new ListFavoriteApi(); +const listFavorite = new ListFavoriteApi(apiConfig); export const loader: LoaderFunction = async (): Promise< FavoriteLoader | Response diff --git a/client/src/pages/login/api/action.ts b/client/src/pages/login/api/action.ts index 5006ad8e..ad7a538f 100644 --- a/client/src/pages/login/api/action.ts +++ b/client/src/pages/login/api/action.ts @@ -2,12 +2,13 @@ import { ActionFunction, redirect } from "react-router-dom"; import { parseLoginForm } from "./../model/parse-login-form"; import { BasicLoginApi } from "generated/api"; import { PROFILE } from "shared/config/paths"; +import { apiConfig } from "shared/config/api"; export interface LoginAction { errors: string[]; } -const basicLoginApi = new BasicLoginApi(); +const basicLoginApi = new BasicLoginApi(apiConfig); export const action: ActionFunction = async ({ request, diff --git a/client/src/pages/profile/api/loader.ts b/client/src/pages/profile/api/loader.ts index c5f218ef..ed2c926b 100644 --- a/client/src/pages/profile/api/loader.ts +++ b/client/src/pages/profile/api/loader.ts @@ -3,8 +3,9 @@ import { GetUserProfileApi } from "generated/api/get-user-profile-api"; import { ProfileDetails } from "generated/model"; import { LOGIN } from "shared/config/paths"; import { redirect } from "react-router-dom"; +import { apiConfig } from "shared/config/api"; -const getUserProfile = new GetUserProfileApi(); +const getUserProfile = new GetUserProfileApi(apiConfig); export const loader = async (): Promise => { const jwt = Jwt.extractFromCookie(); diff --git a/client/src/pages/profile/ui/Profile.page.tsx b/client/src/pages/profile/ui/Profile.page.tsx index 3daf0f21..06effa70 100644 --- a/client/src/pages/profile/ui/Profile.page.tsx +++ b/client/src/pages/profile/ui/Profile.page.tsx @@ -11,8 +11,9 @@ import { LOGIN } from "shared/config/paths"; import { deleteCookie } from "shared/cookie/cookie"; import { COOKIE_JWT_KEY, COOKIE_SESSIONID } from "shared/config/frontend"; import { useDarkMode } from "shared/dark-mode/use-dark-mode"; +import { apiConfig } from "shared/config/api"; -const logout = new LogoutApi(); +const logout = new LogoutApi(apiConfig); export function ProfilePage() { useJwt(); diff --git a/client/src/pages/registration/api/action.ts b/client/src/pages/registration/api/action.ts index fb142d74..8943ff25 100644 --- a/client/src/pages/registration/api/action.ts +++ b/client/src/pages/registration/api/action.ts @@ -1,8 +1,9 @@ import { ActionFunction } from "react-router-dom"; import { parseForm } from "pages/registration/model/parseForm"; import { UserRegistrationApi } from "generated/api/user-registration-api"; +import { apiConfig } from "shared/config/api"; -const userRegistrationApi = new UserRegistrationApi(); +const userRegistrationApi = new UserRegistrationApi(apiConfig); export interface RegistrationAction { errors: string[]; diff --git a/client/src/shared/config/api.ts b/client/src/shared/config/api.ts index 9c0992b4..c1848145 100644 --- a/client/src/shared/config/api.ts +++ b/client/src/shared/config/api.ts @@ -1,5 +1,6 @@ import { Configuration } from "generated/configuration"; export const apiConfig = new Configuration({ - basePath: "http://localhost:50505", + // basePath: "http://88.201.171.120:10001", + basePath: "http://localhost:5000", }); diff --git a/client/src/shared/instrument-card-actions/ui/Favorite.button.tsx b/client/src/shared/instrument-card-actions/ui/Favorite.button.tsx index eab9199c..6799d201 100644 --- a/client/src/shared/instrument-card-actions/ui/Favorite.button.tsx +++ b/client/src/shared/instrument-card-actions/ui/Favorite.button.tsx @@ -11,14 +11,15 @@ import { InstrumentId } from "generated/model"; import Jwt from "domain/model/jwt"; import { COOKIE_JWT_KEY } from "shared/config/frontend"; import { getCookie } from "shared/cookie/cookie"; +import { apiConfig } from "shared/config/api"; interface Props { instrumentId: InstrumentId; } -const listFavorite = new ListFavoriteApi(); -const removeFavorite = new RemoveFavoriteApi(); -const addFavorite = new AddFavoriteApi(); +const listFavorite = new ListFavoriteApi(apiConfig); +const removeFavorite = new RemoveFavoriteApi(apiConfig); +const addFavorite = new AddFavoriteApi(apiConfig); export const FavoriteButton = (props: Props) => { const jwt = useRef(getCookie(COOKIE_JWT_KEY)); diff --git a/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx b/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx index 63d2ca53..89ed8ce7 100644 --- a/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx +++ b/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx @@ -4,6 +4,7 @@ import actionBtnStyle from "./styles/Action.button.module.css"; import { InstrumentDetail } from "generated/model"; import { RemoveFavoriteApi } from "generated/api/remove-favorite-api"; import { useDarkMode } from "shared/dark-mode/use-dark-mode"; +import { apiConfig } from "shared/config/api"; interface Props { instrument: InstrumentDetail; @@ -11,7 +12,7 @@ interface Props { setErrorModal: (errorModal: boolean) => void; } -const removeFavoriteApi = new RemoveFavoriteApi(); +const removeFavoriteApi = new RemoveFavoriteApi(apiConfig); export const RemoveInstrumentButton = (props: Props) => { const { darkMode } = useDarkMode(); diff --git a/client/src/shared/instrument-card/ui/InstrumentPhoto.tsx b/client/src/shared/instrument-card/ui/InstrumentPhoto.tsx index 319ad9fa..7ea996c3 100644 --- a/client/src/shared/instrument-card/ui/InstrumentPhoto.tsx +++ b/client/src/shared/instrument-card/ui/InstrumentPhoto.tsx @@ -2,12 +2,13 @@ import styles from "./styles/InstrumentPhoto.module.css"; import React, { useEffect, useState } from "react"; import { GetInstrumentPhotoApi } from "generated/api/get-instrument-photo-api"; import { InstrumentDetail } from "generated/model"; +import { apiConfig } from "shared/config/api"; interface Props { instrument: InstrumentDetail; } -const getInstrumentPhoto = new GetInstrumentPhotoApi(); +const getInstrumentPhoto = new GetInstrumentPhotoApi(apiConfig); export const InstrumentPhoto = (props: Props) => { const [photo, setPhoto] = useState(); diff --git a/client/src/widgets/catalogue-filter/ui/filters/Country.filter.tsx b/client/src/widgets/catalogue-filter/ui/filters/Country.filter.tsx index 9efd918b..b93e4626 100644 --- a/client/src/widgets/catalogue-filter/ui/filters/Country.filter.tsx +++ b/client/src/widgets/catalogue-filter/ui/filters/Country.filter.tsx @@ -1,12 +1,13 @@ import React, { useEffect, useState } from "react"; import { GetCountriesApi } from "generated/api/get-countries-api"; import { Country } from "generated/model"; +import { apiConfig } from "shared/config/api"; interface Props { onValueChange: (names: Country[]) => void; } -const getCountries = new GetCountriesApi(); +const getCountries = new GetCountriesApi(apiConfig); export const CountryFilter = ({ onValueChange }: Props) => { const [countries, setCountries] = useState([]); diff --git a/client/src/widgets/catalogue-filter/ui/filters/InstrumentType.filter.tsx b/client/src/widgets/catalogue-filter/ui/filters/InstrumentType.filter.tsx index c557d702..39fd4cce 100644 --- a/client/src/widgets/catalogue-filter/ui/filters/InstrumentType.filter.tsx +++ b/client/src/widgets/catalogue-filter/ui/filters/InstrumentType.filter.tsx @@ -2,8 +2,9 @@ import React, { useEffect, useState } from "react"; import textStyle from "./Text.module.css"; import { GetInstrumentTypesApi } from "generated/api/get-instrument-types-api"; import { InstrumentType } from "generated/model/instrument-type"; +import { apiConfig } from "shared/config/api"; -const getInstrumentTypes = new GetInstrumentTypesApi(); +const getInstrumentTypes = new GetInstrumentTypesApi(apiConfig); interface Props { onValueChange: (i: InstrumentType[]) => void; diff --git a/client/src/widgets/catalogue-filter/ui/filters/ManufacturerName.filter.tsx b/client/src/widgets/catalogue-filter/ui/filters/ManufacturerName.filter.tsx index 6bcf190b..5b2c4209 100644 --- a/client/src/widgets/catalogue-filter/ui/filters/ManufacturerName.filter.tsx +++ b/client/src/widgets/catalogue-filter/ui/filters/ManufacturerName.filter.tsx @@ -1,12 +1,13 @@ import React, { useEffect, useState } from "react"; import { GetManufacturersApi } from "generated/api/get-manufacturers-api"; import { Manufacturer, ManufacturerName } from "generated/model"; +import { apiConfig } from "shared/config/api"; interface Props { onValueChange: (names: ManufacturerName[]) => void; } -const getManufacturers = new GetManufacturersApi(); +const getManufacturers = new GetManufacturersApi(apiConfig); export const ManufacturerNameFilter = ({ onValueChange }: Props) => { const [manufacturers, setManufacturers] = useState([]); diff --git a/client/src/widgets/catalogue-filter/ui/filters/Material.filter.tsx b/client/src/widgets/catalogue-filter/ui/filters/Material.filter.tsx index dbcbee4d..f379482d 100644 --- a/client/src/widgets/catalogue-filter/ui/filters/Material.filter.tsx +++ b/client/src/widgets/catalogue-filter/ui/filters/Material.filter.tsx @@ -1,12 +1,13 @@ import React, { useEffect, useState } from "react"; import { GetInstrumentBasicMaterialsApi } from "generated/api"; import { BasicMaterial } from "generated/model"; +import { apiConfig } from "shared/config/api"; interface Props { onValueChange: (names: BasicMaterial[]) => void; } -const getInstrumentMaterials = new GetInstrumentBasicMaterialsApi(); +const getInstrumentMaterials = new GetInstrumentBasicMaterialsApi(apiConfig); export const MaterialFilter = ({ onValueChange }: Props) => { const [materials, setMaterials] = useState([]); diff --git a/tools/docker/docker-compose.yml b/tools/docker/docker-compose.yml index 254cd2bf..3b0b5c3a 100644 --- a/tools/docker/docker-compose.yml +++ b/tools/docker/docker-compose.yml @@ -56,7 +56,7 @@ services: # platforms: # - "linux/amd64" # - "linux/arm64" - container_name: "${MUSE_CLIENT_IMAGE:-muse-client}" + container_name: muse-client ports: - ${CLIENT_PORT}:80 networks: diff --git a/tools/docker/env/dev.env b/tools/docker/env/dev.env index fc53881f..1e572dd6 100644 --- a/tools/docker/env/dev.env +++ b/tools/docker/env/dev.env @@ -1,8 +1,8 @@ SERVER_PORT=10001 -SERVER_DEBUG_PORT=50504 +SERVER_DEBUG_PORT=10002 CLIENT_PORT=50001 -CLIENT_DEV_PORT=3003 +CLIENT_DEV_PORT=50002 POSTGRES_PORT=5555 POSTGRES_USER=muse diff --git a/tools/scripts/buildAndPush.sh b/tools/scripts/buildAndPush.sh index 8a26ca6e..3d55f833 100755 --- a/tools/scripts/buildAndPush.sh +++ b/tools/scripts/buildAndPush.sh @@ -13,10 +13,9 @@ fi dockerTag=$2 -if [ -z "$2" ] - then - echo -e "\033[0;33mNo Docker Tag provided. Latest will be used.\033[0m" - dockerTag="latest" +if [ -z "$2" ]; then + echo -e "\033[0;33mNo Docker Tag provided. Latest will be used.\033[0m" + dockerTag="latest" fi (cd "$rootDir" && ./tools/scripts/openapi/regenerateOpenApi.sh) diff --git a/tools/scripts/clean.sh b/tools/scripts/clean.sh index b9ad1516..07ce7e34 100755 --- a/tools/scripts/clean.sh +++ b/tools/scripts/clean.sh @@ -5,13 +5,14 @@ rootDir="$currentDir/../../" stage=$1 -if [ -z "$1" ] - then - echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" - stage="local" +if [ -z "$1" ]; then + echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" + stage="local" fi (cd "$rootDir/server" && exec ./gradlew clean) + +#https://github.com/docker/docs/issues/20709 (cd "$rootDir" && exec docker compose \ -f ./tools/docker/docker-compose.yml \ --env-file ./tools/docker/env/$stage.env \ diff --git a/tools/scripts/client/buildImage.sh b/tools/scripts/client/buildImage.sh index af7f8127..9e06b96e 100755 --- a/tools/scripts/client/buildImage.sh +++ b/tools/scripts/client/buildImage.sh @@ -33,6 +33,7 @@ fi echo [MUSE CLIENT] creating docker image "$imageFullName"... (DOCKER_BUILDKIT=1 docker buildx build \ + --no-cache \ --platform linux/arm64,linux/amd64 \ -f "${rootDir}/client/Dockerfile" \ -t "$imageFullName" \ diff --git a/tools/scripts/deploy.sh b/tools/scripts/deploy.sh index 3f518dde..6249b278 100755 --- a/tools/scripts/deploy.sh +++ b/tools/scripts/deploy.sh @@ -3,98 +3,70 @@ set -e currentDir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) rootDir="$currentDir/../../" +# --- + if [ -z "$SSH_HOST" ]; then - echo -e "\033[0;31mError: The required environment variable 'SSH_HOST' is not set.\033[0m" - exit 1 + echo -e "\033[0;31mError: The required environment variable 'SSH_HOST' is not set.\033[0m" + exit 1 fi if [ -z "$SSH_PORT" ]; then - echo -e "\033[0;31mError: The required environment variable 'SSH_HOST' is not set.\033[0m" - exit 1 + echo -e "\033[0;31mError: The required environment variable 'SSH_HOST' is not set.\033[0m" + exit 1 fi if [ -z "$SSH_USER" ]; then - echo -e "\033[0;31mError: The required environment variable 'SSH_USER' is not set.\033[0m" - exit 1 + echo -e "\033[0;31mError: The required environment variable 'SSH_USER' is not set.\033[0m" + exit 1 fi if [ -z "$SSH_PASS" ]; then - echo -e "\033[0;31mError: The required environment variable 'SSH_PASS' is not set.\033[0m" - exit 1 + echo -e "\033[0;31mError: The required environment variable 'SSH_PASS' is not set.\033[0m" + exit 1 fi function finish { - echo "Script finished. Executing final command." - docker context use default + docker context use default } trap 'finish' EXIT +# --- stage=$1 -if [ -z "$1" ] - then - echo -e "\033[0;33mNo stage provided. 'DEV' stage will be used.\033[0m" - stage="dev" +if [ -z "$1" ]; then + echo -e "\033[0;33mNo stage provided. 'DEV' stage will be used.\033[0m" + stage="dev" fi dockerRepository=$2 -if [ -z "$2" ] - then - echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m" - dockerRepository="myshx" +if [ -z "$2" ]; then + echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m" + dockerRepository="myshx" fi +(cd "$rootDir" && exec ./tools/scripts/stop.sh "local") +(cd "$rootDir" && exec ./tools/scripts/clean.sh "local") + dockerTag="$stage-$(git rev-parse --short HEAD)" -(cd "$rootDir" && exec ./tools/scripts/stop.sh "$stage") -(cd "$rootDir" && exec ./tools/scripts/clean.sh "$stage") (cd "$rootDir" && exec ./tools/scripts/buildAndPush.sh "$dockerRepository" "$dockerTag") context_name=muse-deploy-server if ! docker context ls --format '{{.Name}}' | grep -q "^${context_name}$"; then - docker context create "${context_name}" --description "[MUSE] Deploy Server" --docker "host=ssh://kiryuxa@88.201.171.120" + # if context not created, so create it + docker context create "${context_name}" --description "[MUSE] Deploy Server" --docker "host=ssh://kiryuxa@88.201.171.120" fi -#if ! docker context inspect "$context_name" &>/dev/null; then -# -#fi - docker context use muse-deploy-server +export MUSE_SERVER_IMAGE="$dockerRepository/muse-server:$dockerTag" +export MUSE_CLIENT_IMAGE="$dockerRepository/muse-client:$dockerTag" +export MUSE_CLIENT_DEV_IMAGE="$dockerRepository/muse-client-dev:$dockerTag" +(cd "$rootDir" && exec ./tools/scripts/stop.sh "$stage") +(cd "$rootDir" && exec ./tools/scripts/clean.sh "$stage") (cd "$rootDir" && exec ./tools/scripts/run.sh "$stage" "prod") echo -e "\033[0;32mList of available ports:\n\033[0m" -(cd "$rootDir" && exec cat ./tools/docker/env/local.env) - - -#sshpass -p "$SSH_PASS" ssh -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" \ -# -o UserKnownHostsFile=/dev/null \ -# -o StrictHostKeyChecking=no \ -# env dockerRepository="$dockerRepository" \ -# env dockerTag="$dockerTag" \ -# env stage="$stage" \ -# env MUSE_JWT_SECRET_KEY="$MUSE_JWT_SECRET_KEY" \ -# 'bash -s' << 'EOF' -#set -e -# -#random_number="$RANDOM" -#muse_project_path="/tmp/muse-project-$random_number" -#echo "Project path: '$muse_project_path'" -# -#git clone https://github.com/bas-kirill/muse-project.git "$muse_project_path" -#cd "$muse_project_path" -# -#export MUSE_SERVER_IMAGE="$dockerRepository/muse-server:$dockerTag" -#export MUSE_CLIENT_IMAGE="$dockerRepository/muse-client:$dockerTag" -#export MUSE_CLIENT_DEV_IMAGE="$dockerRepository/muse-client-dev:$dockerTag" -# -#echo "one" -#(cd ./tools/docker && docker compose config) -#echo "two" -# -#./tools/scripts/stop.sh "$stage" -#./tools/scripts/run.sh "$stage" -#EOF -# +(cd "$rootDir" && exec cat "./tools/docker/env/$stage.env") diff --git a/tools/scripts/run.sh b/tools/scripts/run.sh index 4bab8073..288ed131 100755 --- a/tools/scripts/run.sh +++ b/tools/scripts/run.sh @@ -5,18 +5,16 @@ rootDir="$currentDir/../../" stage=$1 -if [ -z "$1" ] - then - echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" - stage="local" +if [ -z "$1" ]; then + echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" + stage="local" fi profile=$2 -if [ -z "$2" ] - then - echo -e "\033[0;33mNo Docker Profile provided. 'dev' stage will be used.\033[0m" - profile="dev" +if [ -z "$2" ]; then + echo -e "\033[0;33mNo Docker Profile provided. 'dev' stage will be used.\033[0m" + profile="dev" fi (cd "$rootDir" && exec docker compose \ diff --git a/tools/scripts/runLocal.sh b/tools/scripts/runLocal.sh index fd2c8877..24348307 100755 --- a/tools/scripts/runLocal.sh +++ b/tools/scripts/runLocal.sh @@ -5,18 +5,16 @@ rootDir="$currentDir/../../" stage=$1 -if [ -z "$1" ] - then - echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" - stage="local" +if [ -z "$1" ]; then + echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" + stage="local" fi dockerRepository=$2 -if [ -z "$2" ] - then - echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m" - dockerRepository="myshx" +if [ -z "$2" ]; then + echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m" + dockerRepository="myshx" fi (cd "$rootDir" && exec ./tools/scripts/stop.sh "$stage") diff --git a/tools/scripts/stop.sh b/tools/scripts/stop.sh index dbe3be3d..9d747faf 100755 --- a/tools/scripts/stop.sh +++ b/tools/scripts/stop.sh @@ -5,12 +5,27 @@ rootDir="$currentDir/../../" stage=$1 -if [ -z "$1" ] - then - echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" - stage="local" +if [ -z "$1" ]; then + echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m" + stage="local" fi +#if [ "$stage" != "local" ]; then +# context_name=muse-deploy-server +# if ! docker context ls --format '{{.Name}}' | grep -q "^${context_name}$"; then +# docker context create "${context_name}" --description "[MUSE] Deploy Server" --docker "host=ssh://kiryuxa@88.201.171.120" +# fi +# +# docker context use muse-deploy-server +# +# function finish { +# docker context use default +# } +# +# trap 'finish' EXIT +#fi + +# https://github.com/docker/docs/issues/20709 (cd "$rootDir" && exec docker compose \ -f ./tools/docker/docker-compose.yml \ --env-file ./tools/docker/env/$stage.env \