Skip to content

Commit

Permalink
Merge pull request #11 from chaostreff-flensburg/v2-customize-things
Browse files Browse the repository at this point in the history
V2 customize things
  • Loading branch information
scammo committed May 27, 2024
2 parents 159d837 + 0815869 commit 7ff891c
Show file tree
Hide file tree
Showing 177 changed files with 14,965 additions and 2,094 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.yml]
indent_style = space
indent_size = 2
66 changes: 66 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#Laravel Backend
APP_NAME=PGP
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=https://api.bewerben.c3fl.space

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=secret
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

# Database
MYSQL_RANDOM_ROOT_PASSWORD=true
MYSQL_DATABASE=databse
MYSQL_USER=secret
MYSQL_PASSWORD=secret
37 changes: 21 additions & 16 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build and deploy
name: Build and deploy V2

on:
push:
branches: ["main"]
branches: ["v2-customize-things"]

concurrency:
group: ${{ github.ref }}
Expand All @@ -29,21 +29,26 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
- name: Build Frontend
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
context: frontend
file: frontend/Dockerfile
push: true
tags: "ghcr.io/${{ github.repository }}:latest"
build-args: |
"SUPABASE_URL=${{ secrets.SUPABASE_URL }}"
"SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}"
- name: pull and start new image
uses: appleboy/ssh-action@master
tags: "ghcr.io/${{ github.repository }}/frontend:latest"

- name: Build Backend
uses: docker/build-push-action@v3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER_NAME }}
key: ${{ secrets.PRIVATE_KEY}}
script: cd ccs-proposal && docker compose pull && docker compose up -d
context: backend
file: backend/Dockerfile
push: true
tags: "ghcr.io/${{ github.repository }}/backend:latest"

# - name: pull and start new image
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER_NAME }}
# key: ${{ secrets.PRIVATE_KEY}}
# script: cd pretty-good-proposal-v2 && docker compose pull && docker compose up -d
131 changes: 2 additions & 129 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,130 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
frontend/.env
backend/.env
10 changes: 1 addition & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand All @@ -10,14 +10,6 @@
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"deno.enable": true,
"deno.enablePaths": [
"./supabase"
],
"deno.unstable": true,
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
Expand Down
43 changes: 31 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
# PGP - Pretty good Proposal
# PGP - Pretty Good Proposal V2

Purpose build for [Chaotic Catalyst Scholarships (CCS)](https://ccs.chaostreff-flensburg.de/). This is a web application to create and manage proposals for the CCS. [License](./LICENSE)
Mange different proposals tracks with a simple web application [License](./LICENSE).

You can see a running version [bewerben.ccs.chaostreff-flensburg.de](https://bewerben.ccs.chaostreff-flensburg.de/#/). You can find a very [short talk (2:40 Minutes) from cccamp23 on youtube](https://youtu.be/y4a9_POxGws?si=DWvt5urfD1hWnc-6)
First build to manage [Chaotic Catalyst Scholarships (CCS)](https://ccs.chaostreff-flensburg.de/).

You can see a running version [bewerben.c3fl.de](https://bewerben.c3fl.de). You can find a very [short talk (2:40 Minutes) from cccamp23 on youtube](https://youtu.be/y4a9_POxGws?si=DWvt5urfD1hWnc-6)

## Features

- Create Tracks
- Create proposals
- Encyrpt proposals with [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). For more infomration please have a look at the [lib](./src/lib/) Folder and different files.
- Save encrypted proposals to a database. In this case to supabase
- Encyrpt proposals with [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). For more infomration please have a look at the [lib](./src/lib/) Folder and different files.
- Save encrypted proposals to a database.
- Only advisary board can decrypt proposals (with a manuel shared private)
- Advisary board can vote and decide on proposals
- Every Track has a custom URL and public key
- A root user can create tracks, users (advisary board) and connect them both
- You can easily export all track data as json

> This is a work in progress. The application is not ready for easy setup for other projects.
> This is a work in progress. The application could be setup for other projects. Please be aware that this is a very early version. There is no guarantee that this application is secure. Only use it if encrytion is a nice to have feature!!!
## Technical Setup

### Frontend
#### Vue 3 + Vite

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
The Frontendn is a Vue3 (JavaScript) which is completly standalone.

#### Recommended IDE Setup
### Install

- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
`npm i`

### Backend
#### Supabase
[Supabase](https://supabase.com/) is a backend as a service tool. It has a JS SDK and a Postgres database. It only stores encrypted proposal information. Because of limited resources, this technology was chosen.

The Backend is a Laravel application. It uses a sqllite as database.

#### Install

1. Composer install dependecies.
2. Copy .env.example to .env (for local development use .env.example.local.dev)
3. For local development: create `backend/database/database.sqlite`
4. You can create test data by seeding: `php artisan migrate:fresh --seed` (Deletes the database and seeds new Data)

You can use the following Private Key for local development:
```
{"alg":"RSA-OAEP-512","d":"TD6MEN65iy9OFv5Qoz6AXTtaS4DbTuA6wXmMhJMT6M-uiWJ0vjRKOS9xSHkwEg7xWRLIOPmad2oNo9rt7GY6p_bFtYDZ0p4Ug9ji_I-O8TuppRYtROq8uuj8ALSsTFQR2QbCp1QnJOItt0bl05P5LzJ-L3iYwo2RIDbGq5sDRC0Gv0RK0ubUY8OhDpqLh0FUROYcSrT6oKCN4JVs4zD3YIQjOJB6BcbOncn5DT1cnN96sZa9cou7x388ED0DgFTIj564rs7n7iEraoklUTKzT6RPkx5kRmcHpGuMpRfusaWt-Hf1TAP3JFrfg0L__J7SEWnm0n10LyBsqJS1H72oeHP29GWkA80c8XG0g6Quu-DuK8AR-PNhd85qQBgAnSkrUrgWHsIK7nqVX9ljs2ZYmd1k5ZyR9okIDskT6pL1G397O8yMxP3vQo1vqqz8khRm_kIAivqSAPv0G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-gzI4WVupp0riyff5pyKJm8GCwuTMHNK1iikzeAUaSZf5OmE4UkViRJHmBl1ajXTUqKwpUD4lVinCL5RysKZNTL4Q5SSVUDt_qVHWu62IxE2jvlaSw9_pIL1vbOt1ym_zFibETO58_9204n5c9vCD5HbbxrYsUawSO2k8Q","qi":"VAukOsv3nA5P7FALM6S-eRxN23qYQEf70AGT2pbXg51xlLjVHFCczYb8HzFSyZYwV83ECRFldBAnWdWRo7GxCwxiHtnGuXF5UCBPW3bxL8630TvzmIbXwbYtSs5iLLX3m0uceWxtaplSqZNXpm1j9VE0_w2dEu0uOR6KZDVgV6lY_7IcVGtItcMcOc-4DgUObB0djWCBhmQoC4nekz4FV1kJZP0zDMVN1vbvSpoLIW1pUxzNit3_TOjATfxVtFTSrHsVvxqQZwNj1bWZl_5nmGL3z8HYHkDcCR8Uq5iRu3ylxpzBzaCISyQvcYLhhOypHVD8NMyEReQ1_XDV1YQzxw"}
```
18 changes: 18 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
Loading

0 comments on commit 7ff891c

Please sign in to comment.