Skip to content

Commit

Permalink
Initial release of Woo web platform
Browse files Browse the repository at this point in the history
  • Loading branch information
annejan committed Aug 1, 2023
1 parent 0b01210 commit 685b4d5
Show file tree
Hide file tree
Showing 548 changed files with 112,243 additions and 1 deletion.
1 change: 1 addition & 0 deletions .db_requirements
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.0.1
54 changes: 54 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# -----------------------------------------------------
# Environment setting (dev, prod)
# -----------------------------------------------------
APP_ENV=dev
APP_DEBUG=true
# -----------------------------------------------------
# Application configuration
# -----------------------------------------------------

# Unique secret for creating signatures (rememberme, CSRF etc)
APP_SECRET=32f3c49be690d4c5f499093ae7dd3a7d

# Database at-rest encryption key (generated with "php bin/console generate:database-key")
DATABASE_ENCRYPTION_KEY=

# -----------------------------------------------------
# External service configuration
# -----------------------------------------------------

# Database DSN
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=15&charset=utf8"

# Message bus transport method
HIGH_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/high
INGESTOR_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/ingestor
ESUPDATER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/es_updates
GLOBAL_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/global

# Url to the RabbitMQ management interface for statistics
RABBITMQ_STATS_URL=http://guest:[email protected]:15672

# External mailer
# MAILER_DSN=null://null

# Host of the Elasticsearch server
ELASTICSEARCH_HOST=http://127.0.0.1:9200
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=
ELASTICSEARCH_MTLS_CERT_PATH=
ELASTICSEARCH_MTLS_KEY_PATH=
ELASTICSEARCH_MTLS_CA_PATH=

# Host of the Tika text extraction service
TIKA_HOST=http://127.0.0.1:9998

# Redis instance that is used for document content caching
REDIS_URL=redis://localhost:6379

# The name of cookie. Should start with __Host- , but cannot be prefixed
# with __Host- when running on non-TLS connections
COOKIE_NAME=WOOPID

# Issuer of the TOTP tokens, used in 2fa for the totp URI
TOTP_ISSUER=localhost
26 changes: 26 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This env file is used for CI testing.

APP_ENV=dev
APP_SECRET=32f3c49be690d4c5f499093ae7dd3a7d

DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres?serverVersion=15&charset=utf8"

HIGH_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/high
INGESTOR_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/ingestor
ESUPDATER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/es_updates
GLOBAL_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/global

ELASTICSEARCH_HOST=http://localhost:9200
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=
ELASTICSEARCH_MTLS_CERT_PATH=
ELASTICSEARCH_MTLS_KEY_PATH=
ELASTICSEARCH_MTLS_CA_PATH=

TIKA_HOST=http://localhost:9998

REDIS_URL=redis://localhost:6379

COOKIE_NAME=WOOPID

TOTP_ISSUER=localhost
33 changes: 33 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file can be used for local development through docker-compose

APP_ENV=dev
APP_SECRET=32f3c49be690d4c5f499093ae7dd3a7d

DATABASE_URL="postgresql://postgres:postgres@postgres:5432/postgres?serverVersion=15&charset=utf8"

HIGH_TRANSPORT_DSN=amqp://guest:guest@rabbitmq:5672/%2f/high
INGESTOR_TRANSPORT_DSN=amqp://guest:guest@rabbitmq:5672/%2f/ingestor
ESUPDATER_TRANSPORT_DSN=amqp://guest:guest@rabbitmq:5672/%2f/es_updates
GLOBAL_TRANSPORT_DSN=amqp://guest:guest@rabbitmq:5672/%2f/global

# MAILER_DSN=null://null

RABBITMQ_STATS_URL=http://guest:guest@rabbitmq:15672/api/overview
ELASTICSEARCH_HOST=http://elasticsearch:9200
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=
ELASTICSEARCH_MTLS_CERT_PATH=
ELASTICSEARCH_MTLS_KEY_PATH=
ELASTICSEARCH_MTLS_CA_PATH=

TIKA_HOST=http://tika:9998

# The key to encrypt fields in the database. Generate with "bin/console generate:database-key"
DATABASE_ENCRYPTION_KEY=

REDIS_URL=redis://redis:6379

COOKIE_NAME=WOOPID

TOTP_ISSUER=localhost

6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
16 changes: 16 additions & 0 deletions .github/scripts/check-missing-migrations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

echo "🕵️‍♀️ Checking for missing migrations..."
echo

retval=0

for ver in $(ls -1 migrations | cut -c 8-21); do
ls -1R database/woo_db | grep $ver > /dev/null
if [ $? -ne 0 ] ; then
echo "⚠️ Missing migration: $ver"
retval=1
fi
done

exit $retval
42 changes: 42 additions & 0 deletions .github/scripts/comment-updater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const { promises: fs } = require('fs')

module.exports = async function commentUpdate({github, context, core, filename }) {
const {
issue: { number: issue_number },
repo: { owner, repo }
} = context;

const comment_id = await findComment({
github,
core,
owner,
repo,
issue_number,
}, 'PHPUnit results', 'github-actions[bot]');

const comment = await fs.readFile(filename, 'utf8');

const body = 'PHPUnit results for ' + context.workflow + '\n\n' + comment

if (comment_id === undefined) {
github.rest.issues.createComment({ issue_number, owner, repo, body })
} else {
github.rest.issues.updateComment({ comment_id, owner, repo, body })
}
}

async function findComment({github, core, owner, repo, issue_number}, body_to_match, comment_user) {
for await (const {data: comments} of github.paginate.iterator(
github.rest.issues.listComments, {
owner,
repo,
issue_number
})
) {
const comment = comments.find(comment => { return comment.user.login === comment_user && comment.body.includes(body_to_match); });
if (comment) return comment.id
}

// Nothing found
return undefined;
}
16 changes: 16 additions & 0 deletions .github/workflows/documentation-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: lint documentation
on:
pull_request:
paths:
- '**.md'
jobs:
mdlint:
name: lint markDown file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DavidAnson/markdownlint-cli2-action@v11
with:
globs: '**/*.md'

# https://github.com/DavidAnson/markdownlint
80 changes: 80 additions & 0 deletions .github/workflows/migration-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Check for missing migrations

on:
pull_request:
branches: [ main ]

jobs:
sync:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Checkout db
uses: actions/checkout@v3
with:
repository: minvws/nl-rdo-databases
ref: 'main'
token: ${{ secrets.repo_read_only_token }}
path: './database'

- name: check for missing migrations
id: migration_check
run: |
# Run the script and store the output
set +e
OUT="$(sh .github/scripts/check-missing-migrations.sh)"
RETVAL=$?
set -e
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64 | tr -dc 'a-zA-Z0-9')
{
echo "output<<$EOF"
echo "$OUT"
echo "$EOF"
if [[ $RETVAL -eq 1 ]] ; then
echo "missing_migrations=true"
else
echo "missing_migrations=false"
fi
} >> "$GITHUB_OUTPUT"
- name: debug it
run: |
echo ${{ steps }}
echo $GITHUB_OUTPUT
echo $GITHUB_STATE
# Find the comment
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Missing Database Migrations

# Create a comment when migrations are missing in the db repo
- name: Create comment
if: contains(steps.migration_check.outputs.missing_migrations, 'true')
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
## 🦙🦙 Missing Database Migrations detected
```
${{ steps.migration_check.outputs.output }}
```
👨‍💻 Please run `php bin/console woopie:sql:dump` to create the SQL migrations files, and add them to the database repository to get rid of this message.
# Remove comment if no missing migrations
- if: ${{ contains(steps.git.outputs.missing_migrations, 'false') && steps.fc.outputs.comment-id != '' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ steps.fc.outputs.comment-id }}
})
51 changes: 51 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create release package

on:
push:
tags:
- v*

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
registry-url: 'https://npm.pkg.github.com'
- name: Install npm dependencies
run: |
echo "//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.REPO_READ_ONLY_TOKEN }}
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: 8.1
- name: Composer install
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.REPO_READ_ONLY_TOKEN }}"}}'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-dev
- name: Run build task
run: npm run build
- name: Clean build
run: |
rm -r node_modules .git var/cache var/log || true
mkdir -p var/log
mkdir -p var/cache
- name: Create version.json
run: |
echo "{ \"version\": \"${{ env.RELEASE_VERSION }}\", \"git_ref\": \"$GITHUB_SHA\"}" > public/version.json
- name: Create tar
run: tar -czf woo-web_${{ env.RELEASE_VERSION }}.tar.gz ./config ./public/ ./src/ ./templates ./translations ./vendor/ ./.db_requirements ./var/cache ./var/log ./worker-*.conf ./bin/console
- name: Upload release tar
uses: actions/upload-artifact@v3
with:
name: woo-web_${{ env.RELEASE_VERSION }}
path: woo-web_${{ env.RELEASE_VERSION }}.tar.gz
Loading

0 comments on commit 685b4d5

Please sign in to comment.