Skip to content

Commit

Permalink
fix: deploy on Railway
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosduarte committed Apr 29, 2024
1 parent 412a383 commit b448a14
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy-aws-ebs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
# deployment_package: deploy.zip


aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r8b6j1v6
# aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r8b6j1v6


docker build -t ${{ vars.ECR_REPOSITORY }}:${{ github.sha }} .
docker tag site-mapper-12:latest public.ecr.aws/r8b6j1v6/site-mapper-12:latest
# docker build -t ${{ vars.ECR_REPOSITORY }}:${{ github.sha }} .
# docker tag site-mapper-12:latest public.ecr.aws/r8b6j1v6/site-mapper-12:latest

docker push public.ecr.aws/r8b6j1v6/site-mapper-12:latest
docker push ${{ vars.ECR_REPOSITORY_URI }}:${{ github.sha }}
# docker push public.ecr.aws/r8b6j1v6/site-mapper-12:latest
# docker push ${{ vars.ECR_REPOSITORY_URI }}:${{ github.sha }}
2 changes: 1 addition & 1 deletion server/api.http
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### https://www.enki.com | https://code.visualstudio.com | https://fastify.dev
### @baseUrl = https:// http://localhost:3000
@baseUrl = https://project-web-crawler.onrender.com
@baseUrl = https://project-web-crawler-production.up.railway.app/

### Post
POST {{baseUrl}}/domain
Expand Down
12 changes: 0 additions & 12 deletions server/docker-compose.yml

This file was deleted.

8 changes: 4 additions & 4 deletions web/src/hooks/usePostDomain.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useMutation } from 'react-query'

import { queryClient } from '@/lib/react-query'
Expand All @@ -10,10 +11,9 @@ export function usePostDomain() {
onSuccess: () => {
queryClient.invalidateQueries(['getTree', 'getScrapStatus'])
},
onError: () => {
console.log('Error', sendURL)
onError: (e: any) => {
console.error('Error URL: ', e?.message)
queryClient.invalidateQueries(['getTree', 'getScrapStatus'])
},
// throwOnError: (error) => error.response?.status >= 500,
// refetchInterval: 1_000,
})
}
9 changes: 7 additions & 2 deletions web/src/hooks/useStatus.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useQuery } from 'react-query'

import { queryClient } from '@/lib/react-query'
import { getScrapStatus } from '@/services/getScrapStatus'

export function useStatus({ haveDomain }: { haveDomain: boolean }) {
return useQuery({
queryFn: getScrapStatus,
queryKey: ['getScrapStatus', haveDomain],
refetchInterval: 1_000,
enabled: haveDomain,
throwOnError: (error) => error.response?.status >= 500,
// enabled: haveDomain,
onError: (e: any) => {
console.error('Error', e?.message)
queryClient.invalidateQueries(['getTree', 'getScrapStatus'])
},
})
}
9 changes: 7 additions & 2 deletions web/src/hooks/useTree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useQuery } from 'react-query'

import { queryClient } from '@/lib/react-query'
import { getTree } from '@/services/getTree'

export function useTree({ haveDomain }: { haveDomain: boolean }) {
Expand All @@ -8,7 +10,10 @@ export function useTree({ haveDomain }: { haveDomain: boolean }) {
queryKey: ['getTree', haveDomain],
retry: 3,
refetchInterval: 1_000,
enabled: haveDomain,
throwOnError: (error) => error.response?.status >= 500,
// enabled: haveDomain,
onError: (e: any) => {
console.error('Error', e?.message)
queryClient.invalidateQueries(['getTree', 'getScrapStatus'])
},
})
}
3 changes: 1 addition & 2 deletions web/src/lib/axios.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios from 'axios'

export const api = axios.create({
baseURL: 'https://sitemapper-v1-2.onrender.com',
// baseURL: 'https://project-web-crawler.onrender.com',
baseURL: 'https://project-web-crawler-production.up.railway.app/',
// baseURL: 'http://localhost:3000',
})
2 changes: 2 additions & 0 deletions web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SpeedInsights } from '@vercel/speed-insights/react'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { QueryClientProvider } from 'react-query'
import { ReactQueryDevtools } from 'react-query/devtools'

import { App } from '@/App'

Expand All @@ -14,6 +15,7 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<SpeedInsights />
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
</React.StrictMode>,
)

1 comment on commit b448a14

@vercel
Copy link

@vercel vercel bot commented on b448a14 Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.