Skip to content

Commit

Permalink
Adds all the things 🎉 (#1)
Browse files Browse the repository at this point in the history
* Add RSS feeds and more

* Update docker and add the ssh2 php package

* PHP Linting (Pint)

* Update the app a little

* Add key generator

* PHP Linting (Pint)

* update routes

* wip

* Add new routes

* PHP Linting (Pint)

* CS fix

* Fix silly little bug

* wip

* PHP Linting (Pint)

* Update the design a little to better respect the color themeing I am trying to go for

* Fix broken merge

* PHP Linting (Pint)

* maybe patch a bug I think

* Add relation

* Add feeds relation

* Update the today controller to try and fix a difference in the mysql servers being used.

* Add flare

* wip

* Update proxies

* wip

* update domain

* Fix bug

* Publish the route

* disable registration

* PHP Linting (Pint)

* wip

* PHP Linting (Pint)

* Update method name

* Rearrange the controllers

* Update the views

* Migrate the routes

* Add casts

* Add php8.2-ssh2 ext

* PHP Linting (Pint)

* Add spork pages

* Update composer json

* PHP Linting (Pint)

* Remove new dep

* boy this expanded beyond what I expected....  Add Protonmail client, and a matrix server client to pull in messages

* Remove old files, roll keys

* Wip

* Update the design

* Add dynamically created event generation, add bugsnag

* CS fixes

* Cs fixes

* Fix minor bug in bugsnag

* Add admin email?

* Update the banking routes'

* csfixes

* Update tests

* Add operations

* Add additional workflows

* register the thing we need for our tests

* Add some conditional tests

* Update env

* Add .env to source

* sourdce .env to bash....

* Remove and invalidate bugsnag

* Use the password we set

* Change order of imports

* Change out the pipeline forthe containers.... Mayabe thatll work

* Use sail bin script

* swap out the image for sail

* Update for the docker

* Change install order

* Add basic log files

* I Need to know the user name

* Rename the checks

* Would a little npm stuff help at all

* Maybe we can build after we sail up

* Change the to the testing database

* Change the host to mariadb

* Update the dependencies for the containers to see if github would resolve the dns then...

* Force uninstall the mysql

* Ensure we run the create testing db bit before

* Fix the tests

* Try swapping out the cmd

* Try Changing the username

* Phpunit

* CHmod the storage because omfg im about done

* ug

* Revert

* Update the logic for applying tags and verify that the test actually works

* Updategit ignore;

* Ensure we create the keys directory if it doesnt already exist'

* Add logfor empty user

* Remove old legacy POC crap that was causing the tests to default to the user_id = 1 which was the fucking problem
"

---------

Co-authored-by: austinkregel <[email protected]>
  • Loading branch information
austinkregel and austinkregel authored Jan 1, 2024
1 parent a41405e commit 11751ac
Show file tree
Hide file tree
Showing 707 changed files with 42,100 additions and 6,822 deletions.
106 changes: 106 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=testing
DB_USERNAME=sail
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
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_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}"


PLAID_ENVIRONMENT=sandbox
PLAID_CLIENT_ID=
PLAID_DEVELOPMENT_SECRET=
PLAID_PRODUCTION_SECRET=prod_super_secret
PLAID_SANDBOX_SECRET=

SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://meilisearch:7700

WEATHER_API_KEY=
OPEN_WEATHER_KEY=

REDIS_QUEUE=

FTP_HOST=
FTP_USERNAME=
FTP_PASSWORD=

SPORK_ADMIN_EMAILS=

MATRIX_USERNAME=""
MATRIX_PASSWORD=""
MATRIX_HOST=""
MATRIX_ACCESS_TOKEN=""
MATRIX_DEVICE=""
MATRIX_JWT_TOKEN=""

GITHUB_TOKEN=""

SMTP_USERNAME=@proton.me
IMAP_USERNAME=@proton.me
SMTP_PASSWORD=
IMAP_PASSWORD=
SMTP_HOST=proton-bridge
IMAP_HOST=proton-bridge
IMAP_PORT=143
SMTP_PORT=1025

SPORK_DEFAULT_FILESYSTEM=
LINK_SHORTENING_DOMAIN=
RUST_BACKTRACE=

FORGE_CLOUDFLARE_TOKEN=

MATRIX_CLIENT_FOR_COMMUNICATION_VENTURES=
ADMIN_MATRIX_CLIENT_FOR_COMMUNICATION_VENTURES=
49 changes: 49 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,52 @@ VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"


PLAID_ENVIRONMENT=sandbox
PLAID_CLIENT_ID=
PLAID_DEVELOPMENT_SECRET=
PLAID_PRODUCTION_SECRET=prod_super_secret
PLAID_SANDBOX_SECRET=

SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://meilisearch:7700

WEATHER_API_KEY=
OPEN_WEATHER_KEY=

REDIS_QUEUE=

FTP_HOST=
FTP_USERNAME=
FTP_PASSWORD=

SPORK_ADMIN_EMAILS=

MATRIX_USERNAME=""
MATRIX_PASSWORD=""
MATRIX_HOST=""
MATRIX_ACCESS_TOKEN=""
MATRIX_DEVICE=""
MATRIX_JWT_TOKEN=""

GITHUB_TOKEN=""

SMTP_USERNAME=@proton.me
IMAP_USERNAME=@proton.me
SMTP_PASSWORD=
IMAP_PASSWORD=
SMTP_HOST=proton-bridge
IMAP_HOST=proton-bridge
IMAP_PORT=143
SMTP_PORT=1025

SPORK_DEFAULT_FILESYSTEM=
LINK_SHORTENING_DOMAIN=
RUST_BACKTRACE=

FORGE_CLOUDFLARE_TOKEN=

MATRIX_CLIENT_FOR_COMMUNICATION_VENTURES=
ADMIN_MATRIX_CLIENT_FOR_COMMUNICATION_VENTURES=
#BUGSNAG_API_KEY=
9 changes: 2 additions & 7 deletions .github/workflows/cs-checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHP Linting (Pint)
name: Linting (Pint)
on:
workflow_dispatch:
push:
Expand All @@ -15,9 +15,4 @@ jobs:
uses: aglipanci/[email protected]
with:
preset: laravel

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: PHP Linting (Pint)
skip_fetch: true

32 changes: 17 additions & 15 deletions .github/workflows/php-unit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Checks
name: PHP Unit
on: [ pull_request ]
jobs:
phpunit:
Expand All @@ -10,23 +10,25 @@ jobs:
fetch-depth: 0 # important!
- name: setup php
run: |
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt install -y php8.2-{common,cli,gd,curl,mysql,mbstring,dom,xml,simplexml}
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
git submodule init
git submodule update --remote --merge
- name: Install dependencies
run: |
sudo systemctl start mysql.service
mysql -uroot -h127.0.0.1 -proot -e 'CREATE DATABASE IF NOT EXISTS testing;'
sudo apt update && sudo apt install -y php-mysql
composer install --prefer-dist --no-progress --no-suggest
sudo apt update && sudo apt remove mysql* -y
touch storage/logs/laravel.log
touch storage/logs/crontab.log
touch storage/logs/horizon.log
touch database/database.sqlite
npm install
cp .env.ci .env
./bin/sail up -d
npm run build
- name: Run tests
run: |
cp .env.ci .env
touch database/database.sqlite
php artisan key:generate
php vendor/bin/phpunit
./bin/sail art key:generate
export $(cat .env | xargs)
./bin/sail exec mariadb /docker-entrypoint-initdb.d/10-create-testing-database.sh
./bin/sail test
- name: tear down containers
run: |
./bin/sail down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ yarn-error.log
/.vscode
/*.log
/*.pid
storage/*.bin
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ $ ./sail up -d
- [x] DNS Validation/Verification
- [x] Projects, with relations to domains, servers, rss feeds, pages (and redirects), and people in a one to many association for organization.
- [-] Automatically adding and configuring purchased domains to Cloudflare & Laravel Forge, and provision out the routing automatically. (Still in progress)
- [x] Automatic SSL configuration via forge.

## Planned
- [ ] Automatic SSL configuration via forge.
- [ ] IFTTT inspired Dynamic Automations
- [ ] Plaid integration for asset syncing
- [ ] Budgeting per project
Expand All @@ -32,6 +32,32 @@ $ ./sail up -d
- [ ] List tasks from all projects
- [ ] List events from all projects
- [ ] List budget usage -- if applicable.
- [ ] Domain Purchasing and Renewals


### Happily built with Laravel Jetstream Inertia
- Single Chat interface
- Email interface
# Domain Feature Details
This presently uses Cloudflare DNS.

We can configure and manage any DNS records that Cloudflare supports.

We also want to be able to update the NS of registrars to point to Cloudflare

## Domain Syncing
This will sync domains from Namecheap to Cloudflare. It will also sync domains from Cloudflare to Laravel Forge.

# Server Feature Details
We can manage any server listed in our database as long as there is at least an SSH server configured.

Servers house code or perform jobs. They are not necessarily web servers, but can be. When accessed via SSH, you have full access to everything that user has access to.

## Server Feature Details
Laravel Forge, and Digital Ocean are both supported providers, but any server can be added manually and accessed via SSH.

# RSS Feature Details
RSS feeds are synced and updated on a schedule. This is done via a job that runs every 15 minutes.

# Page Feature Details
Pages are dynamic routes that can be configured to point to any domain, or server. They can also be configured to redirect to another page, or domain.

22 changes: 22 additions & 0 deletions app/Actions/Spork/CustomAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Actions\Spork;

use Illuminate\Database\Eloquent\Model;

/**
* Actions are implemented as invokable controllers.
* They should expect to be sent an array of ids that represent the main model.
* public function __invoke(Dispatcher $dispatcher, Request $request)
*/
abstract class CustomAction
{
public function __construct(
public string $name = 'Set Namecheap DNS',
public string $slug = 'custom-action',
public ?string $models = null,
) {
}
}
33 changes: 33 additions & 0 deletions app/Actions/Spork/Domains/SyncNamecheapDnsAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace App\Actions\Spork\Domains;

use App\Contracts\ActionInterface;

class SyncNamecheapDnsAction implements ActionInterface
{
public function __invoke()
{
request()->validate([
'domains' => 'required|array',
'nameservers' => 'required',
]);

$domains = request()->get('domains');

$nameservers = explode(',', request()->get('nameservers', ''));

foreach ($domains as $domain) {
$this->service->updateDomainNs($domain, $nameservers);
}

return 'OK';
}

public function show(): bool
{
return auth()->check();
}
}
37 changes: 37 additions & 0 deletions app/Actions/Spork/SyncDataFromCredential.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace App\Actions\Spork;

use App\Jobs\FetchDomainsForCredential;
use App\Jobs\FetchRegistrarForCredential;
use App\Jobs\FetchServersForCredential;
use App\Jobs\Finance\SyncPlaidTransactionsJob;
use App\Jobs\Servers\LaravelForgeServersSyncJob;
use App\Models\Credential;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Http\Request;

class SyncDataFromCredential extends CustomAction
{
public function __construct($name = 'Sync Data From Credential', $slug = 'sync-data-from-credential')
{
parent::__construct($name, $slug, models: Credential::class);
}

public function __invoke(Dispatcher $dispatcher, Request $request)
{
$credentials = Credential::where('user_id', $request->user()->id)->whereIn('id', $request->get('items'))->get();

foreach ($credentials as $credential) {
$dispatcher->dispatch(match ($credential->type) {
Credential::TYPE_REGISTRAR => new FetchRegistrarForCredential($credential),
Credential::TYPE_DOMAIN => new FetchDomainsForCredential($credential),
Credential::TYPE_SERVER => new FetchServersForCredential($credential),
Credential::TYPE_DEVELOPMENT, 'forge' => new LaravelForgeServersSyncJob($credential),
Credential::TYPE_FINANCE => new SyncPlaidTransactionsJob($credential, now()->subWeek(), now(), false),
});
}
}
}
Loading

0 comments on commit 11751ac

Please sign in to comment.