Compare commits

..

5 Commits

Author SHA1 Message Date
Chris Grimmett
2d2f8ced9b convert strapi to use pnpm
Some checks failed
ci / build (push) Failing after 3m59s
2024-04-02 06:49:33 -08:00
Chris Grimmett
203cc91f31 add some padding to l,r on the vod page 2024-03-29 22:26:26 -08:00
Chris Grimmett
ab368c237c online install 2024-03-29 21:27:56 -08:00
Chris Grimmett
1d35f4b33d add packagejson to the build 2024-03-29 21:01:24 -08:00
Chris Grimmett
c291ef2fb4 use pnpm in package.json scripts 2024-03-29 20:43:38 -08:00
17 changed files with 383 additions and 12446 deletions

View File

@ -1,15 +1,42 @@
include .env include .env
all: minikube secrets tilt
tilt:
tilt up
secrets: secrets:
kubectl delete secret link2cid --ignore-not-found kubectl delete secret link2cid --ignore-not-found
kubectl create secret generic link2cid \ kubectl create secret generic link2cid \
--from-literal=apiKey=${LINK2CID_API_KEY} --from-literal=apiKey=${LINK2CID_API_KEY}
kubectl delete secret vultr kubectl delete secret vultr --ignore-not-found
kubectl create secret generic vultr \ kubectl create secret generic vultr \
--from-literal=vultr=${VULTR_CONTAINER_REGISTRY_USERNAME} --from-literal=vultr=${VULTR_CONTAINER_REGISTRY_USERNAME}
kubectl delete secret strapi --ignore-not-found
kubectl create secret generic strapi \
--from-literal=adminJwtSecret=${STRAPI_ADMIN_JWT_SECRET} \
--from-literal=apiTokenSalt=${STRAPI_API_TOKEN_SALT} \
--from-literal=appKeys=${APP_KEYS} \
--from-literal=databaseUrl=postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME} \
--from-literal=jwtSecret=${STRAPI_JWT_SECRET} \
--from-literal=muxPlaybackRestrictionId=${MUX_PLAYBACK_RESTRICTION_ID} \
--from-literal=muxSigningKeyPrivateKey=${MUX_SIGNING_KEY_PRIVATE_KEY} \
--from-literal=s3UscBucketApplicationKey=${S3_USC_BUCKET_APPLICATION_KEY} \
--from-literal=s3UscBucketEndpoint=${S3_USC_BUCKET_ENDPOINT} \
--from-literal=s3UscBucketName=${S3_USC_BUCKET_NAME} \
--from-literal=s3UscBucketKeyId=${S3_USC_BUCKET_KEY_ID} \
--from-literal=s3UscBucketRegion=${S3_USC_BUCKET_REGION} \
--from-literal=muxSigningKeyId=${MUX_SIGNING_KEY_ID} \
--from-literal=strapiAdminEmail=${STRAPI_ADMIN_EMAIL} \
--from-literal=sendgridApiKey=${SENDGRID_API_KEY} \
--from-literal=cdnBucketUscUrl=${CDN_BUCKET_USC_URL} \
--from-literal=transferTokenSalt=${TRANSFER_TOKEN_SALT}
# --from-literal=sessionSecret=$(SESSION_SECRET) \ # --from-literal=sessionSecret=$(SESSION_SECRET) \
# --from-literal=twitchClientId=$(TWITCH_CLIENT_ID) \ # --from-literal=twitchClientId=$(TWITCH_CLIENT_ID) \

View File

@ -9,7 +9,9 @@ k8s_yaml(helm(
docker_build('fp/link2cid', './packages/link2cid') docker_build('fp/link2cid', './packages/link2cid')
docker_build( docker_build(
'fp/strapi', 'fp/strapi',
'./packages/strapi', '.',
dockerfile='strapi.dockerfile',
target='dev',
live_update=[ live_update=[
sync('./packages/strapi', '/app') sync('./packages/strapi', '/app')
] ]
@ -18,20 +20,20 @@ docker_build(
## Uncomment the following for fp/next in dev mode ## Uncomment the following for fp/next in dev mode
## this is useful for changing the UI and seeing results ## this is useful for changing the UI and seeing results
# docker_build( docker_build(
# 'fp/next', 'fp/next',
# '.', '.',
# dockerfile='next.dockerfile', dockerfile='next.dockerfile',
# target='dev', target='dev',
# live_update=[ live_update=[
# sync('./packages/next', '/app') sync('./packages/next', '/app')
# ] ]
# ) )
## Uncomment the following for fp/next in production mode ## Uncomment the following for fp/next in production mode
## this is useful to test how fp/next will behave in production environment ## this is useful to test how fp/next will behave in production environment
## note: there is no live_update here. expect slow rebuilds in response to code changes ## note: there is no live_update here. expect slow rebuilds in response to code changes
docker_build('fp/next', '.', dockerfile='next.dockerfile') # docker_build('fp/next', '.', dockerfile='next.dockerfile')
k8s_resource( k8s_resource(
@ -60,13 +62,13 @@ k8s_resource(
# port_forwards=['5050'] # port_forwards=['5050']
# ) # )
# k8s_resource( k8s_resource(
# workload='strapi-pod', workload='strapi-pod',
# port_forwards=['1337'], port_forwards=['1337'],
# links=[ links=[
# link('http://localhost:1337/admin', 'Strapi Admin UI') link('http://localhost:1337/admin', 'Strapi Admin UI')
# ] ]
# ) )
# v1alpha1.extension_repo(name='default', url='https://github.com/tilt-dev/tilt-extensions') # v1alpha1.extension_repo(name='default', url='https://github.com/tilt-dev/tilt-extensions')

View File

@ -13,27 +13,27 @@ spec:
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: ADMIN_JWT_SECRET key: adminJwtSecret
- name: API_TOKEN_SALT - name: API_TOKEN_SALT
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: API_TOKEN_SALT key: apiTokenSalt
- name: APP_KEYS - name: APP_KEYS
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: APP_KEYS key: appKeys
- name: DATABASE_URL - name: DATABASE_URL
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: DATABASE_URL key: databaseUrl
- name: CDN_BUCKET_USC_URL - name: CDN_BUCKET_USC_URL
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: CDN_BUCKET_USC_URL key: cdnBucketUscUrl
- name: DATABASE_CLIENT - name: DATABASE_CLIENT
value: postgres value: postgres
- name: DATABASE_HOST - name: DATABASE_HOST
@ -44,61 +44,61 @@ spec:
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: JWT_SECRET key: jwtSecret
- name: MUX_PLAYBACK_RESTRICTION_ID - name: MUX_PLAYBACK_RESTRICTION_ID
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: MUX_PLAYBACK_RESTRICTION_ID key: muxPlaybackRestrictionId
- name: MUX_SIGNING_KEY_ID - name: MUX_SIGNING_KEY_ID
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: MUX_SIGNING_KEY_ID key: muxSigningKeyId
- name: MUX_SIGNING_KEY_PRIVATE_KEY - name: MUX_SIGNING_KEY_PRIVATE_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: MUX_SIGNING_KEY_PRIVATE_KEY key: muxSigningKeyPrivateKey
- name: NODE_ENV - name: NODE_ENV
value: production value: production
- name: S3_USC_BUCKET_APPLICATION_KEY - name: S3_USC_BUCKET_APPLICATION_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: S3_USC_BUCKET_APPLICATION_KEY key: s3UscBucketApplicationKey
- name: S3_USC_BUCKET_ENDPOINT - name: S3_USC_BUCKET_ENDPOINT
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: S3_USC_BUCKET_ENDPOINT key: s3UscBucketEndpoint
- name: S3_USC_BUCKET_KEY_ID - name: S3_USC_BUCKET_KEY_ID
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: S3_USC_BUCKET_KEY_ID key: s3UscBucketKeyId
- name: S3_USC_BUCKET_NAME - name: S3_USC_BUCKET_NAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: S3_USC_BUCKET_NAME key: s3UscBucketName
- name: S3_USC_BUCKET_REGION - name: S3_USC_BUCKET_REGION
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: S3_USC_BUCKET_REGION key: s3UscBucketRegion
- name: SENDGRID_API_KEY - name: SENDGRID_API_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: SENDGRID_API_KEY key: sendgridApiKey
- name: STRAPI_URL - name: STRAPI_URL
value: {{ .Values.strapi.url }} value: {{ .Values.strapi.url }}
- name: TRANSFER_TOKEN_SALT - name: TRANSFER_TOKEN_SALT
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: strapi name: strapi
key: TRANSFER_TOKEN_SALT key: transferTokenSalt
- name: PORT - name: PORT
value: "{{ .Values.strapi.port }}" value: "{{ .Values.strapi.port }}"
resources: resources:

View File

@ -18,10 +18,10 @@ ENV NEXT_PUBLIC_SITE_URL ${NEXT_PUBLIC_SITE_URL}
ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL} ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL}
ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL} ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL}
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1
COPY pnpm-lock.yaml package.json ./ COPY pnpm-lock.yaml ./
RUN pnpm fetch RUN pnpm fetch
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --offline
COPY ./packages/next /app COPY ./packages/next /app
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install
FROM install AS dev FROM install AS dev

View File

@ -1,6 +1,6 @@
{ {
"name": "futureporn", "name": "futureporn",
"version": "1.0.2", "version": "1.0.3",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -43,25 +43,25 @@ export default async function VodPage({vod}: { vod: IVod }) {
return ( return (
<div className="container"> <div className="container">
<div className="block mb-5"> <div className="section pt-0">
<VideoInteractive vod={vod}></VideoInteractive> <VideoInteractive vod={vod}></VideoInteractive>
{(vod.attributes.thumbnail) && (<div className='mb-5'> {(vod.attributes.thumbnail) && (<div className='mb-5'>
<LinkableHeading text="Thumbnail Image" slug="thumb" icon={faImage}></LinkableHeading> <LinkableHeading text="Thumbnail Image" slug="thumb" icon={faImage}></LinkableHeading>
<Thumbnail url={vod.attributes.thumbnail.data.attributes.cdnUrl}></Thumbnail> <Thumbnail url={vod.attributes.thumbnail.data.attributes.cdnUrl}></Thumbnail>
</div>)} </div>)}
{(vod.attributes.videoSrcHash || vod.attributes.video240Hash) && ( {(vod.attributes.videoSrcHash || vod.attributes.video240Hash) && (
<> <>
<LinkableHeading text="IPFS Content IDs" slug="ipfs" icon={faGlobe}></LinkableHeading> <LinkableHeading text="IPFS Content IDs" slug="ipfs" icon={faGlobe}></LinkableHeading>
{vod.attributes.videoSrcHash && ( {vod.attributes.videoSrcHash && (
<IpfsCid label="Source" cid={vod.attributes.videoSrcHash}></IpfsCid> <IpfsCid label="Source" cid={vod.attributes.videoSrcHash}></IpfsCid>
)} )}
{vod.attributes.video240Hash && ( {vod.attributes.video240Hash && (
<IpfsCid label="240p" cid={vod.attributes.video240Hash}></IpfsCid> <IpfsCid label="240p" cid={vod.attributes.video240Hash}></IpfsCid>
)} )}
</> </>
)} )}
<nav className="level mt-5"> <nav className="level mt-5">

View File

@ -0,0 +1,9 @@
.tmp/
.cache/
.git/
.env
build/
node_modules/
# Ignoring folders that might be used in starter templates
data/
backup/

View File

@ -1,28 +0,0 @@
# Creating multi-stage build for production
FROM node:18-alpine as build
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
ENV NODE_ENV=production
WORKDIR /opt/
COPY package.json yarn.lock ./
RUN yarn global add node-gyp
RUN yarn config set network-timeout 600000 -g && yarn install --production
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN yarn build
# Creating final production image
FROM node:18-alpine
RUN apk add --no-cache vips-dev
ENV NODE_ENV=production
WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
WORKDIR /opt/app
COPY --from=build /opt/app ./
ENV PATH /opt/node_modules/.bin:$PATH
RUN chown -R node:node /opt/app
USER node
EXPOSE 1337
CMD ["yarn", "start"]

View File

@ -1,26 +0,0 @@
FROM node:18.16-alpine as base
RUN corepack enable
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /app
FROM base AS build
COPY package.json pnpm-lock.yaml ./
# RUN yarn config set network-timeout 600000 -g && yarn install
RUN pnpm install --frozen-lockfile
COPY . .
ENV PATH=/app/node_modules/.bin:$PATH
RUN chown -R node:node /app
USER node
RUN pnpm run build
EXPOSE 1337
FROM build AS dev
CMD ["pnpm", "run", "dev"]
FROM build AS release
ENTRYPOINT ["pnpm", "run", "start"]

View File

@ -1,31 +0,0 @@
# Creating multi-stage build for production
FROM node:18-alpine as build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
ENV NODE_ENV=production
WORKDIR /opt/
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN pnpm run build
# Creating final production image
FROM node:18-alpine
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apk add --no-cache vips-dev
ENV NODE_ENV=production
WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
WORKDIR /opt/app
COPY --from=build /opt/app ./
ENV PATH /opt/node_modules/.bin:$PATH
RUN chown -R node:node /opt/app
USER node
EXPOSE 1337
CMD ["pnpm", "start"]

View File

@ -1,19 +0,0 @@
FROM node:18-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
COPY package.json yarn.lock ./
RUN yarn global add node-gyp
RUN yarn config set network-timeout 600000 -g && yarn install
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN chown -R node:node /opt/app
USER node
RUN ["yarn", "build"]
EXPOSE 1337
CMD ["yarn", "dev"]

View File

@ -63,7 +63,7 @@
"react-router-dom": "5.3.4", "react-router-dom": "5.3.4",
"react-test-renderer": "^17.0.2", "react-test-renderer": "^17.0.2",
"semver": "^7.5.4", "semver": "^7.5.4",
"sharp": "^0.32.6", "sharp": "0.32.6",
"strapi-plugin-fuzzy-search": "^2.2.0", "strapi-plugin-fuzzy-search": "^2.2.0",
"styled-components": "5.3.3", "styled-components": "5.3.3",
"typescript": "^5.3.3", "typescript": "^5.3.3",
@ -81,7 +81,7 @@
"uuid": false "uuid": false
}, },
"engines": { "engines": {
"node": ">=14.19.1 <=18.x.x", "node": ">=14.19.1 <=19.x.x",
"npm": ">=6.0.0" "npm": ">=6.0.0"
}, },
"license": "MIT" "license": "MIT"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,5 +2,5 @@ packages:
- 'packages/uppy' - 'packages/uppy'
- 'packages/bot' - 'packages/bot'
- 'packages/next' - 'packages/next'
- 'packages/strapi'
# strapi is not on here because it's not compatible with pnpm

51
strapi.dockerfile Normal file
View File

@ -0,0 +1,51 @@
# FROM node:18-alpine
# # Installing libvips-dev for sharp Compatibility
# RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
# ARG NODE_ENV=development
# ENV NODE_ENV=${NODE_ENV}
# WORKDIR /opt/
# COPY ./packages/strapi/package.json ./packages/strapi/yarn.lock ./
# RUN yarn global add node-gyp
# RUN yarn config set network-timeout 600000 -g && yarn install
# ENV PATH /opt/node_modules/.bin:$PATH
# WORKDIR /opt/app
# COPY ./packages/strapi .
# RUN chown -R node:node /opt/app
# USER node
# RUN ["yarn", "build"]
# EXPOSE 1337
# CMD ["yarn", "dev"]
FROM node:18.16-alpine as base
RUN corepack enable
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /app
FROM base AS build
# COPY package.json pnpm-lock.yaml ./
COPY pnpm-lock.yaml ./
# RUN yarn config set network-timeout 600000 -g && yarn install
# RUN pnpm install --frozen-lockfile
RUN pnpm fetch
COPY ./packages/strapi .
RUN pnpm install --offline
# ENV PATH=/app/node_modules/.bin:$PATH
RUN chown -R node:node /app
USER node
# RUN pnpm run build
# EXPOSE 1337
FROM build AS dev
CMD ["pnpm", "run", "dev"]
FROM build AS release
CMD ["pnpm"]
ENTRYPOINT ["run", "start"]