Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d24b474
add migrations
TylerAldrich Aug 8, 2023
20eee9c
Update twitter clone to include db migration, fix a couple bugs preve…
TylerAldrich Aug 8, 2023
401d185
Use tyleraldrich/kratos image currently
TylerAldrich Sep 6, 2023
d2f889b
Add start of deploy action
TylerAldrich Sep 6, 2023
2b90a1f
Store and cache values between runs
TylerAldrich Sep 6, 2023
61759ed
run ./arcctl and not arcctl
TylerAldrich Sep 6, 2023
dbab2d3
Add docker login to build/push components
TylerAldrich Sep 6, 2023
96ef88d
List datacenter for debugging
TylerAldrich Sep 6, 2023
893448e
Set XDG_CONFIG_HOME so arcctl config is loaded/stored properly maybe
TylerAldrich Sep 6, 2023
8ebd9bd
Echo google_credentials to make sure its set
TylerAldrich Sep 6, 2023
e5736d9
Wrong google creds name
TylerAldrich Sep 6, 2023
e13a750
Bump arcctl version for debug info
TylerAldrich Sep 7, 2023
a040030
Install gke plugin so auth works
TylerAldrich Sep 7, 2023
cae97e7
Bump arcctl version for more debug info
TylerAldrich Sep 7, 2023
fe2b461
More debug
TylerAldrich Sep 7, 2023
1a2efa2
Test keeping config dir key the same to avoid potential race cond
TylerAldrich Sep 7, 2023
41b20b3
Update arcctl version
TylerAldrich Sep 7, 2023
c2ce2c8
Update arcctl version
TylerAldrich Sep 7, 2023
02de3b4
Update arcctl version
TylerAldrich Sep 7, 2023
15713ef
Update arcctl version
TylerAldrich Sep 7, 2023
70278a3
Update arcctl version
TylerAldrich Sep 8, 2023
2614a53
Test deploying a change
TylerAldrich Sep 8, 2023
15232b5
Update branch name and test with serverless datacenter running
TylerAldrich Sep 11, 2023
c5b3f45
Add environment file, test deployment via applying environment instea…
TylerAldrich Sep 12, 2023
d43d364
Update arcctl version to fix environment fail not exiting with nonzer…
TylerAldrich Sep 12, 2023
6705ea1
Update environment to use correct component names
TylerAldrich Sep 12, 2023
f4ffdb5
Add local datacenter and upgrade nextjs version
TylerAldrich Sep 12, 2023
197b62a
Add local config, fix issues with login panel breaking between sessions
TylerAldrich Sep 15, 2023
eb2dfef
Update action to run on pull request, uses pull request number in env…
TylerAldrich Sep 18, 2023
e62f9d5
Dont specify master branch for PR
TylerAldrich Sep 18, 2023
bc220ae
Add refresh environment flag and update arcctl version
TylerAldrich Sep 18, 2023
ed36369
Bump arcctl version for new build features
TylerAldrich Sep 19, 2023
327459b
More arcctl updates
TylerAldrich Sep 19, 2023
a570090
Remove unused refresh flag
TylerAldrich Sep 19, 2023
b49bd89
Change cache key of arcctl config to fix issue with bad component build
TylerAldrich Sep 19, 2023
c4565c6
Bump arcctl version to resolve dependency loop bug
TylerAldrich Sep 19, 2023
a43a889
FIx issue with env update failing not failing action
TylerAldrich Sep 19, 2023
f7a9b4e
bump arcctl, added component tagging via sha so redeploys work
TylerAldrich Sep 20, 2023
a0981af
Slightly modify the process.env to see if that makes a difference
TylerAldrich Sep 20, 2023
b8462de
Testing change of title and environment apply
TylerAldrich Sep 20, 2023
59b8d2b
Bump arcctl version
TylerAldrich Sep 20, 2023
f4cf1de
Bump dependency again
TylerAldrich Sep 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Component Deploy

on:
pull_request:

env:
ARCCTL_CACHE_KEY: arcctl-0.3.1 # Hardcoding a version number here so we don't keep downloading this
ARC_DATACENTER: gh-datacenter # gh-serverless-dc
ARC_ENVIRONMENT: ./environments/qa.yml
GCP_ACCOUNT_NAME: gcp-test
GCP_PROJECT: permanent-environment-testing
COMPONENT_NAME: tyleraldrich/twitter-clone:latest
XDG_CONFIG_HOME: ./arcctl-config/

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: arcctl binary
id: arcctl-cache
uses: actions/cache@v3
with:
path: ./arcctl
key: ${{ env.ARCCTL_CACHE_KEY }}
- if: ${{ steps.arcctl-cache.outputs.cache-hit != 'true' }}
name: Download arcctl
run: curl -SL https://arcctl-dcs.nyc3.digitaloceanspaces.com/arcctl --output arcctl
- name: Make arcctl executable
run: chmod +x ./arcctl
- name: arcctl config
uses: actions/cache@v3
with:
path: ${{ env.XDG_CONFIG_HOME }}
key: ${{ github.event.pull_request.number }}
- name: Setup arcctl backend
run: ./arcctl set state.backend --provider s3 --creds accessKeyId=${{ secrets.BUCKET_ACCESS_KEY_ID }} --creds secretAccessKey=${{ secrets.BUCKET_ACCESS_KEY }} --creds endpoint=https://nyc3.digitaloceanspaces.com --creds region=nyc3 --namespace arcctl-dcs
build_component:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- name: Load arcctl binary
id: arcctl-cache
uses: actions/cache@v3
with:
path: ./arcctl
key: ${{ env.ARCCTL_CACHE_KEY }}
- name: arcctl config
uses: actions/cache@v3
with:
path: ${{ env.XDG_CONFIG_HOME }}
key: ${{ github.event.pull_request.number }}
- name: Docker Login
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build component
run: ./arcctl build architect.yml -t ${{ env.COMPONENT_NAME }}
- name: Push component
run: ./arcctl push ${{ env.COMPONENT_NAME }}
deploy_component:
runs-on: ubuntu-latest
needs: build_component
steps:
- uses: actions/checkout@v3
- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
create_credentials_file: true
# Install gcloud, `setup-gcloud` automatically picks up authentication from `auth`.
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Setup GKE gcloud auth plugin
run: gcloud components install gke-gcloud-auth-plugin
- name: Load arcctl binary
id: arcctl-cache
uses: actions/cache@v3
with:
path: ./arcctl
key: ${{ env.ARCCTL_CACHE_KEY }}
- name: arcctl config
uses: actions/cache@v3
with:
path: ${{ env.XDG_CONFIG_HOME }}
key: ${{ github.event.pull_request.number }}
- name: Apply environment
run: ./arcctl apply env qa-${{ github.event.pull_request.number }} ${{ env.ARC_ENVIRONMENT }} -d ${{ env.ARC_DATACENTER}} --auto-approve
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
secret/
4 changes: 2 additions & 2 deletions app/(home)/home-yeet-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const HomeYeetForm = () => {
body: JSON.stringify({
message,
}),
}).then(() => {
location.reload();
});

location.reload();
};

return session ? (
Expand Down
4 changes: 2 additions & 2 deletions app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PageHeader } from '../_components/page-header';
import { HomeYeetForm } from './home-yeet-form';

export const metadata: Metadata = {
title: 'The Y Feed',
description: 'A list of messages yeeted into the ether',
title: 'Y Feed',
description: 'A list of messages yeeted into the ether!',
};

const HomePage = () => {
Expand Down
13 changes: 3 additions & 10 deletions app/_components/app-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { Button } from './button';
import { classNames, getGravatarImageUrl } from './utils';
import { Avatar } from './avatar';
import { oryUserAddr } from '../ory';

export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;

Expand Down Expand Up @@ -81,23 +82,15 @@ export const AppLayout = ({ children }: React.PropsWithChildren) => {
navigation.push(
{
name: 'Sign in',
href:
process.env.NEXT_PUBLIC_USER_SERVICE_ADDR?.replace(/\/$/, '') +
'/login?return_to=' +
returnTo,
href: `${oryUserAddr}/login?return_to=${returnTo}`,
icon: UserIcon,
current: false,
inverted: false,
disabled: false,
},
{
name: 'Sign up',
href:
process.env.NEXT_PUBLIC_USER_SERVICE_ADDR?.replace(/\/$/, '') +
'/registration?return_to=' +
returnTo +
'&after_verification_return_to=' +
returnTo,
href: `${oryUserAddr}/registration?return_to=${returnTo}&after_verification_return_to=${returnTo}`,
icon: UserIcon,
current: false,
inverted: true,
Expand Down
3 changes: 2 additions & 1 deletion app/_components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ export const Button = (props: ButtonProps) => {
}

const btn = <button {...props} className={classes.join(' ')} />;
return props.href ? <Link href={props.href}>{btn}</Link> : btn;
// Using a Link will not work if the href is external, e.g. during login flow.
return props.href ? <a href={props.href}>{btn}</a> : btn;
};
8 changes: 3 additions & 5 deletions app/ory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as sdk from '@ory/client';

export const oryPublicAddr = process.env.NEXT_PUBLIC_KRATOS_ADDR?.replace(
/\/$/,
''
);
export const oryUserAddr = process.env.NEXT_PUBLIC_USER_SERVICE_ADDR;
export const oryPublicAddr = process.env.NEXT_PUBLIC_KRATOS_ADDR;

export const oryClient = new sdk.FrontendApi(
new sdk.Configuration({
Expand All @@ -16,7 +14,7 @@ export const oryClient = new sdk.FrontendApi(

export const oryServer = new sdk.FrontendApi(
new sdk.Configuration({
basePath: process.env.KRATOS_ADDR?.replace(/\/$/, ''),
basePath: process.env.KRATOS_ADDR,
baseOptions: {
withCredentials: true,
},
Expand Down
2 changes: 1 addition & 1 deletion app/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Provider as ReduxProvider } from 'react-redux';
import { store } from '@/store';
import { PropsWithChildren, useRef } from 'react';
import { AuthState, setAuthData } from '@/store/authSlice';
import { setAuthData } from '@/store/authSlice';
import { Session } from '@ory/client';

export const Provider = (
Expand Down
6 changes: 3 additions & 3 deletions architect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ databases:

dependencies:
kratos:
component: architectio/kratos
component: tyleraldrich/kratos
variables:
allowed_return_urls:
- ${{ ingresses.app.url }}
Expand All @@ -22,8 +22,8 @@ deployments:
image: ${{ builds.frontend.id }}
environment:
DB_URL: ${{ databases.main.url }}
KRATOS_ADDR: ${{ dependencies.kratos.services.kratos-public.url }}
KRATOS_ADMIN_ADDR: ${{ dependencies.kratos.services.kratos-admin.url }}
KRATOS_ADDR: ${{ dependencies.kratos.ingresses.kratos-public.url }}
KRATOS_ADMIN_ADDR: ${{ dependencies.kratos.ingresses.kratos-admin.url }}
NEXT_PUBLIC_SELF_ADDR: ${{ ingresses.app.url }}
NEXT_PUBLIC_KRATOS_ADDR: ${{ dependencies.kratos.ingresses.kratos-public.url }}
NEXT_PUBLIC_USER_SERVICE_ADDR: ${{ dependencies.kratos.ingresses.auth.url }}
Expand Down
Loading