From 2adbbd5d23fabda3dba89409ee379f355e188074 Mon Sep 17 00:00:00 2001 From: mrtmeeseeks Date: Fri, 6 Sep 2024 14:08:48 +0300 Subject: [PATCH] changed api to testnet aut backend --- .github/workflows/deploy.yml | 12 +----------- .github/workflows/deploy_prod.yml | 12 +----------- Dockerfile | 20 +++++++++++++++----- docker-compose.yml | 26 +++++++++++++++++++++----- src/api/aut.api.ts | 2 +- src/pages/Oauth2/oauth2.tsx | 6 +++--- 6 files changed, 42 insertions(+), 36 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9a1061a..6697be4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,18 +28,8 @@ jobs: sudo git checkout main; sudo git pull origin main; - echo "Stopping and removing specific service: aut_os_main" sudo docker-compose stop aut_os_main - sudo docker-compose rm -f aut_os_main - - echo "Removing dangling images" sudo docker rmi $(sudo docker images -f "dangling=true" -q) || true - - sudo docker build -t autlabs/aut-os:main . --build-arg ENV_FILE=.env - # sudo docker push autlabs/aut-os:main - - echo "Pulling the new image" - # sudo docker-compose pull aut_os_main - docker-compose up -d --build aut_os_main + sudo docker-compose up --build aut_os_main -d exit 0; \ No newline at end of file diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml index 85c4346..d07fae7 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -28,18 +28,8 @@ jobs: sudo git checkout mainnet; sudo git pull origin mainnet; - echo "Stopping and removing specific service: aut_os_mainnet" sudo docker-compose stop aut_os_mainnet - sudo docker-compose rm -f aut_os_mainnet - - echo "Removing dangling images" sudo docker rmi $(sudo docker images -f "dangling=true" -q) || true - - sudo docker build -t autlabs/aut-os:mainnet . --build-arg ENV_FILE=.env_prod - # sudo docker push autlabs/aut-os:mainnet - - echo "Pulling the new image" - # sudo docker-compose pull aut_os_mainnet - docker-compose up -d --build aut_os_mainnet + sudo docker-compose up --build aut_os_mainnet -d exit 0; \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 449affe..cd4a893 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,22 @@ -FROM node:latest as build +FROM node:alpine as build + WORKDIR /app + ENV PATH /app/node_modules/.bin:$PATH ENV GENERATE_SOURCEMAP=false ENV NODE_OPTIONS=--openssl-legacy-provider -ARG ENV_FILE -ENV ENV_FILE=${ENV_FILE} +ARG REACT_APP_NETWORK_ENV +ARG REACT_APP_API_URL +ARG REACT_APP_NODE_ENV +ARG REACT_APP_DEFAULT_CHAIN_ID +ARG REACT_APP_GRAPH_API_URL + +ENV REACT_APP_NETWORK_ENV=$REACT_APP_NETWORK_ENV +ENV REACT_APP_API_URL=$REACT_APP_API_URL +ENV REACT_APP_NODE_ENV=$REACT_APP_NODE_ENV +ENV REACT_APP_DEFAULT_CHAIN_ID=$REACT_APP_DEFAULT_CHAIN_ID +ENV REACT_APP_GRAPH_API_URL=$REACT_APP_GRAPH_API_URL # COPY .npmrc ./ COPY package.json ./ @@ -14,11 +25,10 @@ COPY package-lock.json ./ RUN npm install --legacy-peer-deps COPY . ./ -COPY ${ENV_FILE} .env RUN npm run build -FROM nginx:stable-alpine +FROM nginx:alpine COPY --from=build /app/build /usr/share/nginx/html COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/docker-compose.yml b/docker-compose.yml index 9a6eaa5..6a6620d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,30 @@ -version: '3.7' +version: "3.7" services: aut_os_mainnet: container_name: aut_os_mainnet - image: autlabs/aut-os:mainnet + build: + context: . + dockerfile: Dockerfile + args: + REACT_APP_NETWORK_ENV: "mainnet" + REACT_APP_API_URL: "https://mainnet-api.aut.id/api" + REACT_APP_NODE_ENV: "production" + REACT_APP_DEFAULT_CHAIN_ID: "137" + REACT_APP_GRAPH_API_URL: "https://subgraph.satsuma-prod.com/57f77e118c8e/3zi14w18sr5q42jggc1n6a--464735/aut-mainnet/api" ports: - - '5003:80' + - "5003:80" aut_os_main: container_name: aut_os_main - image: autlabs/aut-os:main + build: + context: . + dockerfile: Dockerfile + args: + REACT_APP_NETWORK_ENV: "testnet" + REACT_APP_API_URL: "https://testnet-api.aut.id/api" + REACT_APP_NODE_ENV: "development" + REACT_APP_DEFAULT_CHAIN_ID: "80002" + REACT_APP_GRAPH_API_URL: "https://subgraph.satsuma-prod.com/57f77e118c8e/3zi14w18sr5q42jggc1n6a--464735/aut-amoy/api" ports: - - '5003:80' + - "5003:80" \ No newline at end of file diff --git a/src/api/aut.api.ts b/src/api/aut.api.ts index 6a01333..61a7933 100644 --- a/src/api/aut.api.ts +++ b/src/api/aut.api.ts @@ -7,7 +7,7 @@ import { useEffect, useState } from "react"; export const getAppConfig = (): Promise => { return axios - .get(`${environment.apiUrl}/autid/config/network/${environment.networkEnv}`) + .get(`${environment.apiUrl}/aut/config/network/${environment.networkEnv}`) .then((r) => r.data); }; diff --git a/src/pages/Oauth2/oauth2.tsx b/src/pages/Oauth2/oauth2.tsx index e3d4fd1..e009d29 100644 --- a/src/pages/Oauth2/oauth2.tsx +++ b/src/pages/Oauth2/oauth2.tsx @@ -53,7 +53,7 @@ export const useOAuth = () => { onFailure(error); } else { const response = await axios.post( - `${environment.apiUrl}/autID/config/oauth2AccessTokenDiscord`, + `${environment.apiUrl}/aut/config/oauth2AccessTokenDiscord`, { code: message.data.payload.code, callbackUrl @@ -113,7 +113,7 @@ export const useOAuth = () => { onFailure(error); } else { const response = await axios.post( - `${environment.apiUrl}/autID/config/oauth2AccessTokenX`, + `${environment.apiUrl}/aut/config/oauth2AccessTokenX`, { code: message.data.payload.code, callbackUrl @@ -173,7 +173,7 @@ export const useOAuth = () => { onFailure(error); } else { const response = await axios.post( - `${environment.apiUrl}/autID/config/oauth2AccessTokenGithub`, + `${environment.apiUrl}/aut/config/oauth2AccessTokenGithub`, { code: message.data.payload.code, callbackUrl