Skip to content

Commit

Permalink
Merge branch 'release/1.0.0' into feature/issue-cache-control
Browse files Browse the repository at this point in the history
  • Loading branch information
sashapanasiuk5 committed Sep 13, 2024
2 parents 97363ed + 283d01e commit 8c454d4
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 75 deletions.
10 changes: 6 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pipeline {
sh "cat version"
vers = readFile(file: 'version').trim()
sh "echo ${vers}"
env.vers="${vers}"
env.CODE_VERSION = readFile(file: 'version').trim()
echo "${env.CODE_VERSION}"
SEM_VERSION="${env.CODE_VERSION}"
Expand Down Expand Up @@ -234,14 +235,15 @@ pipeline {
}
steps {
script {

git branch: 'master', credentialsId: 'test_git_user', url: '[email protected]:ita-social-projects/StreetCode_Client.git'
sh 'echo ${BRANCH_NAME}'
sh "git checkout master"
sh 'echo ${BRANCH_NAME}'
sh 'git merge ${BRANCH_NAME}'
sh "npm version 1.0.0 -m 'Upgrade to %s as part of release'"

sh "git push origin main"
sh "npm version ${env.vers} --allow-same-version --no-git-tag-version"
sh "git add ."
sh "git commit -m 'Upgrade to %s as part of release'"
sh "git push origin master"

}
}
Expand Down
107 changes: 51 additions & 56 deletions config/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Dotenv = require("dotenv-webpack");
const CopyPlugin = require('copy-webpack-plugin');
const Webpack = require("webpack");
const { GenerateSW } = require("workbox-webpack-plugin");
const fs = require("fs");
Expand All @@ -14,12 +13,12 @@ module.exports = {
open: true,
port: "3000",
historyApiFallback: true,
//https: {
// https: {
// DEV.NOTE: uncomment and change names of files according to your generated ones

//key: fs.readFileSync("cert\\localhost+1-key.pem"),
//cert: fs.readFileSync("cert\\localhost+1.pem"),
//},
// key: fs.readFileSync("cert\\localhost+1-key.pem"),
// cert: fs.readFileSync("cert\\localhost+1.pem"),
// },
},
module: {
rules: require("./webpack.rules"),
Expand All @@ -39,57 +38,53 @@ module.exports = {
new Dotenv({
path: `./.env`,
}),
new GenerateSW({
skipWaiting: true,
clientsClaim: true,
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: /env-config\.js$/,
handler: 'NetworkOnly'
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'CacheFirst',
options: {
cacheName: 'static-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
},
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
handler: 'CacheFirst',
options: {
cacheName: 'image-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
},
},
},
{
urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
handler:'CacheFirst',
options: {
cacheName: 'font-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 90, // 3 months
},
},
},
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'external-resources',
expiration: {
maxEntries: 260
},
},
},
],
}),
// new GenerateSW({
// skipWaiting: true,
// clientsClaim: true,
// maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
// runtimeCaching: [
// {
// urlPattern: /\.(?:js|css)$/,
// handler: 'CacheFirst',
// options: {
// cacheName: 'static-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
// },
// },
// },
// {
// urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
// handler: 'CacheFirst',
// options: {
// cacheName: 'image-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
// },
// },
// },
// {
// urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
// handler:'CacheFirst',
// options: {
// cacheName: 'font-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 90, // 3 months
// },
// },
// },
// {
// urlPattern: /^https?.*/,
// handler: 'NetworkFirst',
// options: {
// cacheName: 'external-resources',
// expiration: {
// maxEntries: 260
// },
// },
// },
// ],
// }),
],
optimization: {
splitChunks: {
Expand Down
4 changes: 0 additions & 4 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ module.exports = {
clientsClaim: true,
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: /env-config\.js$/,
handler: 'NetworkOnly'
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'NetworkFirst',
Expand Down
99 changes: 99 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
services:
certbot:
restart: always
image: certbot/certbot:latest
volumes:
- /etc/certbot/www/:/var/www/certbot/:rw
- /etc/certbot/conf/:/etc/letsencrypt/:rw

nginx:
restart: always
image: nginx:latest
ports:
- "80:80"
- "443:443"
environment:
FRONTEND_SERVER_NAME: ${FRONTEND_SERVER_NAME}
BACKEND_SERVER_NAME: ${BACKEND_SERVER_NAME}
volumes:
- ./templates:/etc/nginx/templates
- /etc/certbot/www:/var/www/certbot/:ro
- /etc/certbot/conf:/etc/nginx/ssl/:ro


loki:
restart: always
container_name: loki
image: grafana/loki:latest
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
volumes:
- ./loki/config:/etc/loki

frontend:
restart: always
image: streetcodeua/streetcode_client:${DOCKER_TAG_FRONTEND}
pull_policy: always
expose:
- "80"
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 30s
timeout: 10s
retries: 5
environment:
API_URL: ${ENV_API_BACKEND}
REACT_APP_GOOGLE_ANALYTICS: ${ENV_GOOGLE_ANALYTICS}
RECAPTCHA_SITE_KEY: ${RECAPTCHA_SITE_KEY}
logging:
driver: loki
options:
loki-url: "http://localhost:3100/loki/api/v1/push"

backend:
restart: always
image: streetcodeua/streetcode:${DOCKER_TAG_BACKEND}
pull_policy: always
expose:
- "80"
environment:
STREETCODE_ConnectionStrings__DefaultConnection: ${DB_CONNECTION_STRING}
STREETCODE_Blob__BlobStoreKey: ${BLOB_STORAGE_KEY}
STREETCODE_Blob__BlobStorePath: /mnt/data/
STREETCODE_Instagram__InstagramID: ${INSTAGRAM_ID}
STREETCODE_Instagram__InstagramToken: ${INSTAGRAM_TOKEN}
STREETCODE_Payment__Token: ${PAYMENT_TOKEN}
STREETCODE_EMAILCONFIGURATION__PASSWORD: ${EMAIL_PASSWORD}
STREETCODE_RECAPTCHA__SECRETKEY: ${RECAPTCHA_SECRET_KEY}
STREETCODE_CORS__AllowedOrigins: ${CORS_ALLOWED_ORIGINS}
STREETCODE_CORS__AllowedHeaders: ${CORS_ALLOWED_HEADERS}
STREETCODE_CORS__AllowedMethods: ${CORS_ALLOWED_METHODS}
STREETCODE_CORS__ExposedHeaders: ${CORS_EXPOSED_HEADERS}
STREETCODE_CORS__PreflightMaxAge: "600"
STREETCODE_IPRATELIMITING__GENERALRULES__0__LIMIT: 500
ASPNETCORE_ENVIRONMENT: ${SWAGGER_APP_ENVIRONMENT}
volumes:
- type: bind
source: /imagestorage
target: /mnt/data
healthcheck:
test: curl --fail http://localhost/api/partners/getAll || exit 1
interval: 30s
timeout: 10s
retries: 5
extra_hosts:
- "host.docker.internal:host-gateway"
logging:
driver: loki
options:
loki-url: "http://localhost:3100/loki/api/v1/push"
volumes:
backend:
networks:
backend:
external:
name: backend
frontend:
external:
name: frontend
1 change: 0 additions & 1 deletion public/env-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ window._env_ = {
API_URL: "https://stageback.streetcode.com.ua/api",
REACT_APP_GOOGLE_ANALYTICS: "REACT_APP_GOOGLE_ANALYTICS_VALUE",
RECAPTCHA_SITE_KEY: "6LeUO3ApAAAAAOC7F4v0qTsSwIR9mZu33SWjAAtM",
VERSION: "1.0.0"
}
16 changes: 6 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { RouterProvider } from 'react-router-dom';
import router from '@app/router/Routes';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import WithClearCache from './app/common/components/withClearCache';

declare global {
interface Window {
Expand All @@ -17,7 +16,6 @@ declare global {
SERVER_API_URL: string;
REACT_APP_GOOGLE_ANALYTICS: string;
RECAPTCHA_SITE_KEY: string;
VERSION: string;
};
}
}
Expand All @@ -41,12 +39,10 @@ const root = ReactDOM.createRoot(
const queryClient = new QueryClient();

root.render(
<WithClearCache>
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
<ReactQueryDevtools initialIsOpen />
</QueryClientProvider>
</React.StrictMode>
</WithClearCache>,
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
<ReactQueryDevtools initialIsOpen />
</QueryClientProvider>
</React.StrictMode>,
);

0 comments on commit 8c454d4

Please sign in to comment.