Skip to content

Commit

Permalink
Merge branch 'master' into play/1586_date_area
Browse files Browse the repository at this point in the history
  • Loading branch information
markdoeswork authored Oct 23, 2024
2 parents a98afcd + 70085cc commit 6af5cf5
Show file tree
Hide file tree
Showing 114 changed files with 3,800 additions and 1,386 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ node_modules
yarn-error.log
playbook/stats.json
*.dec.*
.env
4 changes: 4 additions & 0 deletions .sops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ creation_rules:
- arn: "arn:aws:kms:us-east-1:205083374951:key/405f40cd-a18a-40ed-bf2f-a0e7816a9a5c"
- arn: "arn:aws:kms:us-east-1:205083374951:key/405f40cd-a18a-40ed-bf2f-a0e7816a9a5c"
role: "arn:aws:iam::205083374951:role/playbook-admins"
- arn: "arn:aws:kms:us-east-1:205083374951:key/405f40cd-a18a-40ed-bf2f-a0e7816a9a5c"
role: "arn:aws:iam::205083374951:role/forever-people"

- key_groups:
- kms:
- arn: "arn:aws:kms:us-east-1:205083374951:key/d46e780d-ee0a-4a7d-b049-0443e1b91d41"
- arn: "arn:aws:kms:us-east-1:205083374951:key/d46e780d-ee0a-4a7d-b049-0443e1b91d41"
role: "arn:aws:iam::205083374951:role/playbook-admins"
- arn: "arn:aws:kms:us-east-1:205083374951:key/d46e780d-ee0a-4a7d-b049-0443e1b91d41"
role: "arn:aws:iam::205083374951:role/forever-people"
3 changes: 3 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ app.build(
memory: '10Gi',
]
],
storageConfig: [
size: '15Gi',
],
])
}

Expand Down
20 changes: 19 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ services:
- image-registry.powerapp.cloud/playbook/playbook:main
volumes:
- .:/home/app/src
- bundle:/usr/local/bundle
- bundle:/usr/local/rvm/gems
ports:
- "8089:3000"
depends_on:
db:
condition: service_healthy
db:
platform: linux/x86_64
image: percona:8.0.36-28@sha256:1128d56e64711ed65cb0c57041048967ee5875a2167d708d327885fd1f995fa0
init: true
ports:
- 3306
environment:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: password
healthcheck:
test: ["CMD", "mysql", "-u", "root", "-ppassword", "-e", "SHOW DATABASES;"]
interval: 5s
timeout: 2s
retries: 5
start_period: 20s
6 changes: 5 additions & 1 deletion milano.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ dependencies:

machine:
directory: playbook-website/
environment:
CLUSTER: app-prod-hq

deploy: &deploy
max_commits: # Automatically deploy all commits, no matter how many.
pre:
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} namespace=${GITHUB_REPO_NAME}-${ENVIRONMENT} deploy_url=${DEPLOY_URL} bin/pre_deploy"
override:
- ./bin/deployer bash -lc "cluster=app-prod-hq environment=${ENVIRONMENT} tag=${REVISION} deploy_url=${DEPLOY_URL} bin/deploy"
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} namespace=${GITHUB_REPO_NAME}-${ENVIRONMENT} deploy_url=${DEPLOY_URL} bin/deploy"

rollback:
<<: *deploy
Expand Down
6 changes: 5 additions & 1 deletion milano.staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ dependencies:

machine:
directory: playbook-website/
environment:
CLUSTER: app-beta-hq

deploy: &deploy
max_commits: # Automatically deploy all commits, no matter how many.
pre:
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} namespace=${GITHUB_REPO_NAME}-${ENVIRONMENT} deploy_url=${DEPLOY_URL} bin/pre_deploy"
override:
- ./bin/deployer bash -lc "cluster=app-beta-hq environment=${ENVIRONMENT} tag=${REVISION} deploy_url=${DEPLOY_URL} bin/deploy"
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} namespace=${GITHUB_REPO_NAME}-${ENVIRONMENT} deploy_url=${DEPLOY_URL} bin/deploy"

rollback:
<<: *deploy
Expand Down
4 changes: 3 additions & 1 deletion milano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ machine:

deploy: &deploy
max_commits: # Automatically deploy all commits, no matter how many.
pre:
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} namespace=${GITHUB_REPO_NAME}-${ENVIRONMENT} deploy_url=${DEPLOY_URL} bin/pre_deploy"
override:
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} deploy_url=${DEPLOY_URL} bin/deploy"
- ./bin/deployer bash -lc "cluster=${CLUSTER} environment=${ENVIRONMENT} tag=${REVISION} namespace=${GITHUB_REPO_NAME}-${ENVIRONMENT} deploy_url=${DEPLOY_URL} bin/deploy"

rollback:
<<: *deploy
Expand Down
1 change: 1 addition & 0 deletions playbook-website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ yarn-debug.log*
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local
.env

1 change: 1 addition & 0 deletions playbook-website/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ruby "3.3.0"

gem "playbook_ui", path: "../playbook"

gem "mysql2", "0.5.6"
gem "rails", "~> 7.0.8"
gem "turbo-rails", "~> 1.4.0"
gem "puma", "~> 6.3"
Expand Down
4 changes: 3 additions & 1 deletion playbook-website/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../playbook
specs:
playbook_ui (14.5.0)
playbook_ui (14.6.0)
actionpack (>= 5.2.4.5)
actionview (>= 5.2.4.5)
activesupport (>= 5.2.4.5)
Expand Down Expand Up @@ -140,6 +140,7 @@ GEM
mini_mime (1.1.5)
minitest (5.25.1)
msgpack (1.7.2)
mysql2 (0.5.6)
net-imap (0.4.15)
date
net-protocol
Expand Down Expand Up @@ -332,6 +333,7 @@ DEPENDENCIES
front_matter_parser (~> 1.0.1)
health_check
listen
mysql2 (= 0.5.6)
playbook_ui!
psych (< 4)
puma (~> 6.3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ const globalPropsValues = [
type: "union",
values: '"wrap" | "nowrap" | "wrapReverse"'
},
{
prop: "htmlOptions",
type: "object",
values: "{ [key: string]: string | number | boolean | (() => void); }"
},
{
prop: "id",
type: "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react'
import { Card, Nav, SectionSeparator, NavItem } from 'playbook-ui'
import GlobalProps from './globalProps'
import GlobalPropsValues from './globalPropsValues'
import KitProps from './kitProps'

type AvailablePropsType = {
Expand All @@ -10,8 +11,15 @@ type AvailablePropsType = {

const AvailableProps = ({ availableProps, darkMode }: AvailablePropsType) => {
const props = JSON.parse(availableProps)
const globalPropsNames = GlobalPropsValues.map(prop => prop.prop)
const [showKitTab, setShowKitTab] = useState(true)

for(var propName in props) {
if(globalPropsNames.includes(propName)) {
delete props[propName]
}
}

return (
<>
<Card padding="none" dark={darkMode}>
Expand Down
5 changes: 5 additions & 0 deletions playbook-website/app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
5 changes: 5 additions & 0 deletions playbook-website/bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ fi

extraBindings="{\"ingress\":{\"hosts\":[\"${deploy_url}\"]}}"

# Priority resources
source "${workDir}/bin/priority_deploy"
priority_deploy

# Application Deployment
krane render \
--filenames=${workDir}/config/deploy/templates \
--bindings="@${workDir}/config/deploy/values.yaml" $environmentValuesFile $environmentSecretsFile "image_tag=${tag}" "environment=${environment}" $extraBindings \
Expand Down
2 changes: 1 addition & 1 deletion playbook-website/bin/deployer
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ -t 0 ]; then
AWS_CREDS_MOUNT="--mount type=bind,source=${HOME}/.aws/credentials,destination=/root/.aws/credentials,readonly"
fi

DEPLOYER_IMAGE="image-registry.powerapp.cloud/app/deployer:master-467d8015ffc91fc62c347367db792bb6de0eeea8-1439"
DEPLOYER_IMAGE="image-registry.powerapp.cloud/app/deployer:main-559f8a815f07c3e04dc82bf416c403ef80f6eacb-42"
DEPLOYER_MOUNTS="${AWS_CREDS_MOUNT} --mount type=bind,source=$(pwd),destination=/app --mount type=bind,source=${HOME}/.kube,destination=/root/.kube"
RUN_DEPLOYER="docker run --tty ${INTERACTIVE} ${EXTRA_ARGS} --rm --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY ${DEPLOYER_MOUNTS} ${DEPLOYER_IMAGE}"

Expand Down
87 changes: 87 additions & 0 deletions playbook-website/bin/deployment_helpers
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

set -eo pipefail

: ${baseline:="review"}

function setup_colors() {
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
NOFORMAT='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
else
NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
fi
}
export -f setup_colors
setup_colors

function begin {
local message=$1

echo "\
=======================================
BEGIN: $message
=======================================
"
}
export -f begin

function succeed {
local message=$1

echo -e "\
${GREEN}
=======================================
SUCCESS: $message
=======================================
${NOFORMAT}"
}
export -f succeed

function fail {
local message=$1

echo -e "\
#{RED}
=======================================
ERROR: $message
=======================================
#{NOFORMAT}"
exit 1
}
export -f fail

function instance_name {
local inst=$environment
echo "$inst"
}
export -f instance_name

function log() {
echo >&2 -e "[$cluster][$namespace][$task_name] ${1-}"
}

log "BEGIN: $task_name"
trap 'log "${RED:-}ERROR: $task_name - $cluster / $namespace${NOFORMAT:-}"' ERR

function decrypt() {
local encrypted_file_path=
encrypted_file_path="$1"

local decrypted_file_path=
decrypted_file_path="$2"

secrets="$(sops --decrypt "$encrypted_file_path")"
if [ ! -e "$decrypted_file_path" ]
then
log "writing decrypted secrets for: $encrypted_file_path"
echo -n "$secrets" > "$decrypted_file_path"
fi
}
Loading

0 comments on commit 6af5cf5

Please sign in to comment.