Skip to content

Commit

Permalink
Merge branch 'master' into map-buttons-motuz
Browse files Browse the repository at this point in the history
  • Loading branch information
motuz0001 authored Nov 4, 2024
2 parents 518cbdb + 4a84ce3 commit e20f947
Show file tree
Hide file tree
Showing 237 changed files with 6,396 additions and 8,883 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,12 @@ jobs:
name: Set branch environment
command: |
echo 'export VITE_PROJECT_VERSION=${CIRCLE_SHA1}' >> $BASH_ENV
echo 'export VITE_SITE_VARIANT=test-ci' >> $BASH_ENV
- run:
name: Check environment variables
command: |
echo $VITE_PROJECT_VERSION
echo $VITE_SITE_VARIANT
- run:
command: yarn build
- persist_to_workspace:
Expand Down Expand Up @@ -356,7 +358,7 @@ jobs:
--build-secret VITE_SENTRY_DSN="$VITE_SENTRY_DSN" \
--build-secret VITE_GA_TRACKING_ID="$VITE_GA_TRACKING_ID" \
--build-secret VITE_PATREON_CLIENT_ID="$VITE_PATREON_CLIENT_ID" \
--build-secret VITE_PLATFORM_THEME="$VITE_PLATFORM_THEME" \
--build-secret VITE_PLATFORM_PROFILES="$VITE_PLATFORM_PROFILES" \
--build-secret VITE_PROJECT_VERSION="$VITE_PROJECT_VERSION" \
--build-secret VITE_SUPPORTED_MODULES="$VITE_SUPPORTED_MODULES" \
--build-secret VITE_ACADEMY_RESOURCE="$VITE_ACADEMY_RESOURCE" \
Expand Down Expand Up @@ -401,6 +403,7 @@ jobs:
- run:
command: npm run test ci prod
environment:
VITE_SITE_VARIANT: test-ci
CI_BROWSER: << parameters.CI_BROWSER >>
CI_NODE: << parameters.CI_NODE >>
CI_GROUP: ci-<< parameters.CI_BROWSER >>
Expand Down
11 changes: 8 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
### Prefix VITE_ to use client-side (only for non-sensitive data!)
PORT=3000
WS_URLS=localhost:24678,ws://localhost:24678

# All valid options for VITE_THEME: project-kamp, fixing-fashion or precious-plastic
VITE_THEME=precious-plastic
# VITE_THEME=fixing-fashion
# VITE_THEME=project-kamp

VITE_ACADEMY_RESOURCE=https://onearmy.github.io/academy/
# VITE_ACADEMY_RESOURCE=https://project-kamp-academy.netlify.app/
# VITE_ACADEMY_RESOURCE=https://fixing-fashion-academy.netlify.app/
Expand All @@ -17,4 +18,8 @@ VITE_COMMUNITY_PROGRAM_URL=https://community.preciousplastic.com/academy/guides/
VITE_PROFILE_GUIDELINES_URL=https://community.preciousplastic.com/academy/guides/platform
# VITE_PROFILE_GUIDELINES_URL=https://drive.google.com/file/d/1fXTtBbzgCO0EL6G9__aixwqc-Euqgqnd/view
# VITE_PROFILE_GUIDELINES_URL=https://community.fixing.fashion/academy/guides/profile
VITE_QUESTIONS_GUIDELINES_URL=https://community.preciousplastic.com/academy/guides/guidelines-questions
VITE_QUESTIONS_GUIDELINES_URL=https://community.preciousplastic.com/academy/guides/guidelines-questions

# For testing, VITE_PLATFORM_PROFILES in localStorage is prioritised over this value
# All valid options for VITE_PLATFORM_PROFILES: "member,workspace,community-builder,space,collection-point,machine-builder"
VITE_PLATFORM_PROFILES="member,workspace,community-builder,collection-point,machine-builder"
11 changes: 11 additions & 0 deletions .github/actions/destroy-fly-preview-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine

RUN apk add --no-cache curl jq

RUN curl -L https://fly.io/install.sh | FLYCTL_INSTALL=/usr/local sh

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
12 changes: 12 additions & 0 deletions .github/actions/destroy-fly-preview-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Destroy fly.io app"
description: "Destroy fly.io app if matching app name found"
author: iSCJT
branding:
icon: "delete"
color: "red"
runs:
using: "docker"
image: "Dockerfile"
inputs:
name:
description: Fly app name
16 changes: 16 additions & 0 deletions .github/actions/destroy-fly-preview-app/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh -l

set -ex

# Change underscores to hyphens.
app="${INPUT_NAME//_/-}"


if ! flyctl status --app "$app"; then
echo "App name not found"
exit 1
fi

flyctl apps destroy "$app" -y
echo "App $app successfully destroyed"
exit 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Fly PR Preview
name: Deploy Fly PR Preview
on:
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
pull_request_target:
Expand All @@ -16,7 +16,7 @@ on:
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
# Set these to your Fly.io organization and preferred region.
FLY_REGION: cdg
FLY_REGION: ams
FLY_ORG: one-army

jobs:
Expand Down Expand Up @@ -45,8 +45,7 @@ jobs:

- name: Deploy PR app to Fly.io
id: deploy
uses: superfly/fly-pr-review-apps@1.2.1
uses: superfly/fly-pr-review-apps@1.3.0
with:
config: fly-preview.toml
name: community-platform-pr-${{ github.event.number }}
secrets: VITE_SITE_VARIANT=preview VITE_PROJECT_VERSION=${GITHUB_SHA}
name: community-platform-pr-${{ github.event.number }}
29 changes: 29 additions & 0 deletions .github/workflows/pr-preview-fly-destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Destroy Fly PR Preview

on:
pull_request_target:
types:
- unlabeled

env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

jobs:
label_removed:
if: github.event.label.name == 'Review allow-preview ✅'
runs-on: ubuntu-latest
continue-on-error: true
concurrency:
group: pr-${{ github.event.number }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}

- name: Destroy fly.io preview app
id: destroy
uses: ./.github/actions/destroy-fly-preview-app
with:
name: community-platform-pr-${{ github.event.number }}
35 changes: 35 additions & 0 deletions .github/workflows/pr-preview-remove-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Remove PR Preview Label
on:
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
pull_request_target:
# Trigger when labels are changed or more commits added to a PR that contains labels
types: [closed]

jobs:
preview_app:
if: contains(github.event.pull_request.labels.*.name, 'Review allow-preview ✅')
runs-on: ubuntu-latest
continue-on-error: true
# Only run one deployment at a time per PR.
concurrency:
group: pr-${{ github.event.number }}

steps:
- name: Get code
uses: actions/checkout@v4
with:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}

- name: Remove preview label
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: github.event.number,
name: 'Review allow-preview ✅',
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 0 additions & 70 deletions .github/workflows/pr-preview.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ARG VITE_FIREBASE_STORAGE_BUCKET
ARG VITE_SENTRY_DSN
ARG VITE_GA_TRACKING_ID
ARG VITE_PATREON_CLIENT_ID
ARG VITE_PLATFORM_THEME
ARG VITE_PLATFORM_PROFILES
ARG VITE_PROJECT_VERSION
ARG VITE_SUPPORTED_MODULES
ARG VITE_ACADEMY_RESOURCE
Expand Down Expand Up @@ -66,12 +66,12 @@ RUN --mount=type=secret,id=VITE_BRANCH \
--mount=type=secret,id=VITE_SENTRY_DSN \
--mount=type=secret,id=VITE_GA_TRACKING_ID \
--mount=type=secret,id=VITE_PATREON_CLIENT_ID \
--mount=type=secret,id=VITE_PLATFORM_THEME \
--mount=type=secret,id=VITE_PROJECT_VERSION \
--mount=type=secret,id=VITE_SUPPORTED_MODULES \
--mount=type=secret,id=VITE_ACADEMY_RESOURCE \
--mount=type=secret,id=VITE_API_URL \
--mount=type=secret,id=VITE_PROFILE_GUIDELINES_URL \
--mount=type=secret,id=VITE_PLATFORM_PROFILES \
--mount=type=secret,id=VITE_SITE_NAME \
--mount=type=secret,id=VITE_THEME \
--mount=type=secret,id=VITE_DONATIONS_BODY \
Expand All @@ -91,7 +91,7 @@ RUN --mount=type=secret,id=VITE_BRANCH \
VITE_SENTRY_DSN="$(cat /run/secrets/VITE_SENTRY_DSN)" && \
VITE_GA_TRACKING_ID="$(cat /run/secrets/VITE_GA_TRACKING_ID)" && \
VITE_PATREON_CLIENT_ID="$(cat /run/secrets/VITE_PATREON_CLIENT_ID)" && \
VITE_PLATFORM_THEME="$(cat /run/secrets/VITE_PLATFORM_THEME)" && \
VITE_PLATFORM_PROFILES="$(cat /run/secrets/VITE_PLATFORM_PROFILES)" && \
VITE_PROJECT_VERSION="$(cat /run/secrets/VITE_PROJECT_VERSION)" && \
VITE_SUPPORTED_MODULES="$(cat /run/secrets/VITE_SUPPORTED_MODULES)" && \
VITE_ACADEMY_RESOURCE="$(cat /run/secrets/VITE_ACADEMY_RESOURCE)" && \
Expand All @@ -116,7 +116,7 @@ RUN --mount=type=secret,id=VITE_BRANCH \
echo "VITE_SENTRY_DSN=\"${VITE_SENTRY_DSN}\"" >> .env && \
echo "VITE_GA_TRACKING_ID=\"${VITE_GA_TRACKING_ID}\"" >> .env && \
echo "VITE_PATREON_CLIENT_ID=\"${VITE_PATREON_CLIENT_ID}\"" >> .env && \
echo "VITE_PLATFORM_THEME=\"${VITE_PLATFORM_THEME}\"" >> .env && \
echo "VITE_PLATFORM_PROFILES=\"${VITE_PLATFORM_PROFILES}\"" >> .env && \
echo "VITE_PROJECT_VERSION=\"${VITE_PROJECT_VERSION}\"" >> .env && \
echo "VITE_SUPPORTED_MODULES=\"${VITE_SUPPORTED_MODULES}\"" >> .env && \
echo "VITE_ACADEMY_RESOURCE=\"${VITE_ACADEMY_RESOURCE}\"" >> .env && \
Expand Down
49 changes: 49 additions & 0 deletions Dockerfile.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# syntax = docker/dockerfile:1

FROM node:20-slim AS base

LABEL fly_launch_runtime="Remix"

# Remix app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"
ARG YARN_VERSION=3.6.4

# Install Yarn 3
RUN corepack enable && \
yarn set version ${YARN_VERSION}

# Throw-away build stage to reduce size of final image
FROM base AS build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3

# Copy source code
COPY . .

# Install packages
RUN yarn install

RUN echo "VITE_SITE_VARIANT=\"preview\"" >> .env && \
echo "VITE_GA_TRACKING_ID=\"G-G4QQ9NSQPC\"" >> .env && \
echo "VITE_PATREON_CLIENT_ID=\"RLgZo7SKNVn8cOyFlYeGZsNnoCOjvzQiNJFskDfoxltZltjPPGNMPokwJckHNphU\"" >> .env && \
echo "VITE_THEME=\"precious-plastic\"" >> .env && \
echo "VITE_PLATFORM_PROFILES=\"member,workspace,community-builder,collection-point,machine-builder\"" >> .env

# Build application
RUN yarn run build

# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "yarn", "run", "start" ]

19 changes: 10 additions & 9 deletions fly-ff.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
app = 'community-platform-ff'
primary_region = 'cdg'
primary_region = 'ams'

[build]

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = 'off'
processes = ['app']
internal_port = 3000
force_https = true
auto_stop_machines = 'suspend'
min_machines_running = 1
processes = ['app']

[env]
VITE_BRANCH = "production"
VITE_BRANCH = "production"

[[vm]]
memory = '4gb'
cpu_kind = 'shared'
cpus = 4
memory = '4gb'
cpu_kind = 'shared'
cpus = 4
Loading

0 comments on commit e20f947

Please sign in to comment.