diff --git a/.github/workflows/discord-notifications.yml b/.github/workflows-backup/discord-notifications.yml similarity index 100% rename from .github/workflows/discord-notifications.yml rename to .github/workflows-backup/discord-notifications.yml diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows-backup/validate-pr-title.yml similarity index 100% rename from .github/workflows/validate-pr-title.yml rename to .github/workflows-backup/validate-pr-title.yml diff --git a/.github/workflows/build_and_deploy_k8s.yml b/.github/workflows/build_and_deploy_k8s.yml new file mode 100644 index 000000000..8fbb1a080 --- /dev/null +++ b/.github/workflows/build_and_deploy_k8s.yml @@ -0,0 +1,118 @@ +name: Docker build + +on: + workflow_dispatch: + + push: + branches: + - main + - develop + - feature/update-0.8 + release: + types: + - published + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker_build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Get version from package.json + id: package_version + run: echo "version=v$(jq -r .version package.json)" >> $GITHUB_OUTPUT + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + # generate Docker tags based on the following events/attributes + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}},value=${{ steps.package_version.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=${{ steps.package_version.outputs.version }} + type=semver,pattern={{major}},value=${{ steps.package_version.outputs.version }} + type=sha + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build, cache and push docker image + uses: docker/build-push-action@v3 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + deploy_do: + needs: docker_build + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - namespace: production + publicDomain: automation.tookey.io + - namespace: develop + publicDomain: automation.develop.tookey.io + permissions: + # The "id-token: write" permission is required or Machine ID will not be able to authenticate with the cluster. + id-token: write + contents: read + + steps: + - uses: actions/checkout@v3 + + - name: Set environment variables + run: | + # Short name for current branch. For PRs, use target branch (base ref) + GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}} + GIT_BRANCH=${GIT_BRANCH//\//-} # Replace / with - + GIT_BRANCH=${GIT_BRANCH//_/-} # Replace _ with - + GIT_BRANCH=${GIT_BRANCH,,} # Lower case + HELM_SHORT=`echo "${{ github.event.repository.name }}" | cut -c -52` + echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV + echo "HELM_SHORT=$HELM_SHORT" >> $GITHUB_ENV + + - name: Install doctl and Authorize to Digital Ocean + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + + - name: Login to registry + run: doctl registry login --expiry-seconds 3600 + + - name: Save DigitalOcean kubeconfig with short-lived credentials + run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.DIGITALOCEAN_K8S_CLUSTER_ID }} + + - name: Docker Image Tag + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha + + - name: Deploy + if: github.ref == 'refs/heads/main' || matrix.namespace != 'production' + run: | + helm upgrade --install $HELM_SHORT ./.helm --namespace ${{ matrix.namespace }} --set image=${{ steps.meta.outputs.tags }} --set publicDomain=${{ matrix.publicDomain }} --set branch=$GIT_BRANCH --dry-run + helm upgrade --install $HELM_SHORT ./.helm --namespace ${{ matrix.namespace }} --set image=${{ steps.meta.outputs.tags }} --set publicDomain=${{ matrix.publicDomain }} --set branch=$GIT_BRANCH --wait diff --git a/.github/workflows/image_build.yml b/.github/workflows/image_build.yml deleted file mode 100644 index a78550bc0..000000000 --- a/.github/workflows/image_build.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Docker build - -on: - workflow_dispatch: - - push: - branches: - - main - - develop - release: - types: - - published - - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - docker_build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - - uses: actions/checkout@v3 - - - - name: Login to GHCR - if: github.event_name != 'pull_request' - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - # generate Docker tags based on the following events/attributes - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - - name: Build, cache and push docker image - uses: docker/build-push-action@v3 - with: - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/.helm/templates/100_automation.yaml b/.helm/templates/100_automation.yaml new file mode 100644 index 000000000..295f5e57c --- /dev/null +++ b/.helm/templates/100_automation.yaml @@ -0,0 +1,89 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: automation + namespace: {{ $.Release.Namespace }} + labels: + service: automation +spec: + replicas: 1 + minReadySeconds: 15 + selector: + matchLabels: + service: automation + template: + metadata: + labels: + service: automation + spec: + containers: + - name: service + image: {{ $.Values.image }} + livenessProbe: + exec: + command: [ "/bin/true" ] + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + securityContext: + privileged: true + readinessProbe: + exec: + command: [ "/bin/true" ] + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + resources: + limits: + cpu: 400m + memory: 2048Mi + requests: + cpu: 200m + memory: 512Mi + ports: + - name: 'http' + containerPort: 80 + envFrom: + - secretRef: + name: automation-env + optional: false + + +--- +apiVersion: v1 +kind: Service +metadata: + namespace: {{ $.Release.Namespace }} + name: automation +spec: + type: ClusterIP + selector: + service: automation + ports: + - port: 80 + targetPort: 80 + name: "http" + +--- +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + namespace: {{ $.Release.Namespace }} + name: automation +spec: + entryPoints: + - websecure + routes: + - match: "Host(`automation.{{ $.Values.publicDomain }}`)" + kind: Rule + services: + - name: automation + port: 80 + - match: "Host(`automation.{{ $.Release.Namespace }}.{{ $.Values.cloudDomain }}`)" + kind: Rule + services: + - name: automation + port: 80 + tls: + secretName: traefik-cloudflare-cert diff --git a/.helm/values.yaml b/.helm/values.yaml new file mode 100644 index 000000000..d11359f58 --- /dev/null +++ b/.helm/values.yaml @@ -0,0 +1,4 @@ +# image variable injected by CLI +image: +publicDomain: 'tookey.io' +cloudDomain: 'tookey.cloud' \ No newline at end of file diff --git a/README.md b/README.md index c428e2309..521dc7204 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [Website](https://tookey.io/product/automation), [Docs](https://tookey.gitbook.io/) -Tookey is Web3 automation based on open-source Activepieces software. Tookey integrates EVM, The Graph, Covalent with incorporation with Google Sheets, OpenAI, Discord, and RSS, along with 80+ other integrations. [The list of supported integrations](https://www.activepieces.com/docs/pieces/overview) continues to grow rapidly, thanks to valuable contributions from the community. +Tookey is Web3 automation based on open-source Activepieces software. Tookey integrates EVM, The Graph, Covalent with incorporation with Google Sheets, OpenAI, Discord, and RSS, along with 80+ other integrations. [The list of supported integrations](https://tookey.io/integrations) continues to grow rapidly, thanks to valuable contributions from the community. diff --git a/packages/ui/common/src/lib/environments/environment.prod.ts b/packages/ui/common/src/lib/environments/environment.prod.ts index 5000e52ba..f8b1a39af 100755 --- a/packages/ui/common/src/lib/environments/environment.prod.ts +++ b/packages/ui/common/src/lib/environments/environment.prod.ts @@ -1,51 +1,24 @@ -export const apps = { - production: true, - apiUrl: 'https://automation.tookey.io/api/v1', - jwtTokenName: 'token', - redirectUrl: 'https://automation.tookey.io', - backendUrl: 'https://backend.apps-production.tookey.cloud', - userPropertyNameInLocalStorage: 'currentUser', - //You need to edit index.html manually - websiteTitle: 'Tookey Automation', - activateBeamer: false, - showFeedbackButton: false, - showDocsButton: false, - showUserProfile: true, - // BEGIN EE - firebase: { - apiKey: 'AIzaSyBik7RRZ6S8QIpG4GqzwoF_SCNn3Dr9PPw', - authDomain: 'activepieces-b3803.firebaseapp.com', - projectId: 'activepieces-b3803', - storageBucket: 'activepieces-b3803.appspot.com', - messagingSenderId: '89039225374', - appId: '1:89039225374:web:7e9279293327e02123640f', - }, - // END EE -} as const; +const isProductionEnv = () => { + const origin = window.location.origin; + if (origin === 'https://automation.tookey.io') { + return true + } else if (origin.includes('production')) { + return true + } + + return false +} -const aofg = { - production: true, - apiUrl: 'https://automation.aofg.io/api/v1', +export const environment ={ + production: isProductionEnv(), + apiUrl: window.location.origin + '/api/v1', jwtTokenName: 'token', - redirectUrl: 'https://automation.aofg.io', - backendUrl: 'https://backend.aofg-production.tookey.cloud', + redirectUrl: window.location.origin, + backendUrl: isProductionEnv() ? 'https://backend.production.tookey.cloud' : 'https://backend.develop.tookey.cloud', userPropertyNameInLocalStorage: 'currentUser', - websiteTitle: 'Tookey Test Automation', + websiteTitle: 'Tookey Automation', activateBeamer: false, showFeedbackButton: false, showDocsButton: false, showUserProfile: true, - // BEGIN EE - firebase: { - apiKey: 'AIzaSyBik7RRZ6S8QIpG4GqzwoF_SCNn3Dr9PPw', - authDomain: 'activepieces-b3803.firebaseapp.com', - projectId: 'activepieces-b3803', - storageBucket: 'activepieces-b3803.appspot.com', - messagingSenderId: '89039225374', - appId: '1:89039225374:web:7e9279293327e02123640f', - }, -} as const; - - - -export const environment = window.location.hostname.includes('aofg') ? aofg : apps; +} \ No newline at end of file diff --git a/packages/ui/feature-builder-right-sidebar/src/lib/step-type-sidebar/step-type-item/step-type-item.component.html b/packages/ui/feature-builder-right-sidebar/src/lib/step-type-sidebar/step-type-item/step-type-item.component.html index 8e179ab86..e70662a8f 100755 --- a/packages/ui/feature-builder-right-sidebar/src/lib/step-type-sidebar/step-type-item/step-type-item.component.html +++ b/packages/ui/feature-builder-right-sidebar/src/lib/step-type-sidebar/step-type-item/step-type-item.component.html @@ -39,7 +39,7 @@ + (click)="openDocs('https://tookey.io/integrations/'+ itemDetails.extra.appName.replace('@activepieces/piece-', ''))"> diff --git a/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts b/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts index 60f615e77..07ad18206 100755 --- a/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts +++ b/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts @@ -49,7 +49,7 @@ export class SidenavRoutesListComponent { ]; openDocs() { - window.open('https://activepieces.com/docs', '_blank', 'noopener'); + window.open('https://tookey.gitbook.io/docs', '_blank', 'noopener'); } redirectHome(newWindow: boolean) { if (newWindow) {