Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add kubernetes #153

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1485e3d
feat: add kubernetes
irony Feb 9, 2022
3120d8e
chore: iteam-pub
irony Feb 9, 2022
6b7ede2
feat: add autodeploy from github
irony Feb 9, 2022
dc252a7
fix: add deps
irony Feb 9, 2022
507d60c
fix: add deps
irony Feb 9, 2022
50e6ea4
fix: add pggconf
irony Feb 9, 2022
2b53e17
fix: add nasm too
irony Feb 9, 2022
bbb35c5
fix: fix problem with digital envelope unsupported
irony Feb 9, 2022
ea994aa
fix: use node 16 instead to prevent build errors
irony Feb 9, 2022
b7611f5
fix: use node 16 instead to prevent build errors
irony Feb 9, 2022
8e502fe
chore: re-add deps
irony Feb 9, 2022
40732b3
fix: more deps optipng
irony Feb 9, 2022
77f280f
chore: never trust copilot completely
irony Feb 9, 2022
2336282
chore: update dependencies
irony Feb 9, 2022
c98d917
fix: typo in image name
irony Feb 10, 2022
6a434e6
fix: statup.se
irony Feb 10, 2022
b527737
remove tagmanager
irony Feb 10, 2022
8d0716d
feat: remove google analytics
irony Feb 10, 2022
30a2e26
feat: remove hubspot
irony Feb 10, 2022
8f46969
feat: remove hubspot cookies until you have actively pressed book
irony Feb 10, 2022
d809ca3
merge: with main
irony Feb 10, 2022
165f7d3
chore: move docker to client
irony Feb 10, 2022
184fe81
fix: update skaffold
irony Feb 10, 2022
b65a5f8
chore: use existing cert
irony Feb 10, 2022
fa157e4
feat: include sanity env variables at build time
irony Feb 11, 2022
c27a6c6
feat: add sanity build args
irony Feb 18, 2022
30cd452
chore: use latest skaffold version
irony Feb 18, 2022
a8db2ba
chore: also update skaffold build action
irony Feb 18, 2022
ce131bc
feat: tag image latest and use the latest image as cache for the next…
irony Feb 23, 2022
b2fe651
fix: pass env variables to build step
irony May 9, 2022
01591e1
fix: send env directly to skaffold
irony May 9, 2022
b4b0a6c
feat: send environment varialbes to build step. Also use staticProps …
irony May 10, 2022
70b012d
fix: static props dont work on components..
irony May 10, 2022
d6afc0b
fix: store sanity keys as secrets
irony May 10, 2022
1ccb531
feat: new deploy script that pushes to fluxcd
irony Feb 17, 2023
b6ae9a6
feat: publish to k8s via fluxcd
irony Feb 17, 2023
adb519c
fix: remove npm version
irony Feb 17, 2023
2ab7b93
fix: add env variables
irony Feb 17, 2023
d1f2626
fix: use same token on render
irony Feb 17, 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
64 changes: 64 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This is a basic workflow to help you get started with Actions

name: Build & Deploy to Dev

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master, feat/k8s]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-and-deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Cache skaffold image builds & config
uses: actions/cache@v2
with:
path: ~/.skaffold/
key: skaffold
restore-keys: |
skaffold

- name: Config git bot user
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

- name: Build with Skaffold
uses: hiberbee/github-action-skaffold@latest
env:
SANITY_READ_DATA_TOKEN: ${{ secrets.SANITY_READ_DATA_TOKEN }}
SANITY_API_TOKEN: ${{ secrets.SANITY_API_TOKEN }}
SANITY_PREVIEW_SECRET: ${{ secrets.SANITY_PREVIEW_SECRET }}
with:

command: build
repository: registry.iteam.services
digest-source: tag

- name: Render output
uses: hiberbee/github-action-skaffold@latest
env:
SANITY_READ_DATA_TOKEN: ${{ secrets.SANITY_READ_DATA_TOKEN }}
SANITY_API_TOKEN: ${{ secrets.SANITY_API_TOKEN }}
SANITY_PREVIEW_SECRET: ${{ secrets.SANITY_PREVIEW_SECRET }}
with:
command: render --output deploy/latest.yaml
cache-file: ''
repository: registry.iteam.services
digest-source: tag

- name: Push new manifest to FluxCD
run: |
git add deploy/latest.yaml
git commit --amend --no-edit
git push
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
.env
53 changes: 53 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat autoconf automake build-base curl git libtool make nodejs npm pkgconf nasm yasm optipng
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules

ARG SANITY_READ_DATA_TOKEN
ARG SANITY_API_TOKEN
ARG SANITY_PREVIEW_SECRET

ENV SANITY_READ_DATA_TOKEN $SANITY_READ_DATA_TOKEN
ENV SANITY_API_TOKEN $SANITY_API_TOKEN
ENV SANITY_PREVIEW_SECRET $SANITY_PREVIEW_SECRET


RUN yarn build && yarn install --production --ignore-scripts --prefer-offline

# Production image, copy all the files and run next
FROM node:16-alpine AS runner
WORKDIR /app

ENV NODE_ENV production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

USER nextjs

EXPOSE 3000

ENV PORT 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
ENV NEXT_TELEMETRY_DISABLED 1

CMD ["node_modules/.bin/next", "start"]
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"google-libphonenumber": "^3.2.24",
"google-map-react": "^1.1.7",
"gray-matter": "^4.0.3",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^9.0.0",
"lodash": "^4.17.15",
"lru-cache": "^6.0.0",
Expand Down
1 change: 0 additions & 1 deletion client/photos-used.txt

This file was deleted.

23 changes: 15 additions & 8 deletions client/src/components/HubspotForm/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import React, { useState } from "react"
import styled from "styled-components"

import { Title, Box } from "../Core"
import { Title, Box, Button } from "../Core"

import { device } from "../../utils"

Expand All @@ -21,13 +21,15 @@ const HubspotForm = ({
value,
title = "Boka intromöte direkt i kalendern",
}) => {
const [formVisible, setFormVisible] = useState(false)
React.useEffect(() => {
if (!formVisible) return
const script = document.createElement("script")
script.src =
"https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js"
script.async = true
document.body.appendChild(script)
}, [])
}, [formVisible])

return (
<FormStyled
Expand All @@ -39,11 +41,16 @@ const HubspotForm = ({
<Box>
<Title>{title}</Title>
</Box>
<input type="hidden" name="form-name" value={value} />
<div
className="meetings-iframe-container"
data-src="https://meetings.hubspot.com/jonna-hjern/intromote-iteam?embed=true"
/>
{ formVisible ? (<>
<input type="hidden" name="form-name" value={value} />
<div
className="meetings-iframe-container"
data-src="https://meetings.hubspot.com/jonna-hjern/intromote-iteam?embed=true"
/>
</>
) : (
<Button onClick={() => setFormVisible(true)}>Hitta tid i vår kalender</Button>
)}
</FormStyled>
)
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/PageWrapper/PageWrapper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useContext } from "react"
import React, { useEffect, useContext } from 'react'

import GlobalContext from "../../context/GlobalContext"
import GlobalContext from '../../context/GlobalContext'

const PageWrapper = ({ children, headerDark = false, footerDark = false }) => {
const gContext = useContext(GlobalContext)
Expand Down
10 changes: 0 additions & 10 deletions client/src/context/GlobalContext.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from "react"
import { Helmet } from "react-helmet"

const GlobalContext = React.createContext()

Expand Down Expand Up @@ -69,15 +68,6 @@ const GlobalProvider = ({ children }) => {
decCartTotal,
}}
>
<Helmet>
<script
type="text/javascript"
id="hs-script-loader"
async
defer
src="//js.hs-scripts.com/5211588.js"
></script>
</Helmet>
{children}
</GlobalContext.Provider>
)
Expand Down
Loading