Skip to content

Commit

Permalink
Merge pull request #1 from DripDropz/wallet_auth
Browse files Browse the repository at this point in the history
Wallet authentication support
  • Loading branch information
latheesan-k authored Nov 28, 2024
2 parents 768d2fe + fe15790 commit 98f22fa
Show file tree
Hide file tree
Showing 6,507 changed files with 1,839,064 additions and 319 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
25 changes: 23 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ up:
$(MAKE) composer-install
./docker/wait-for-mysql.sh
$(MAKE) db-migrate
$(MAKE) frontend-build

.PHONY: down
down:
Expand All @@ -17,16 +18,32 @@ down:
build:
docker compose build
$(MAKE) up
docker exec -it rewardengine-web bash -c "npm install && npm run build"
$(MAKE) frontend-build

#
# Helper functions
#

.PHONY: frontend-build
frontend-build:
docker exec -it rewardengine-web bash -c "npm install && npm run build"

.PHONY: frontend-watch
frontend-watch:
docker exec -it rewardengine-web bash -c "npm install && npm run dev"

.PHONY: frontend-upgrade
frontend-upgrade:
docker exec -it rewardengine-web bash -c "npm update"

.PHONY: composer-install
composer-install:
docker exec -it rewardengine-web bash -c "composer install"

.PHONY: deploy-sidecar
deploy-sidecar:
docker exec -it rewardengine-web bash -c "php artisan sidecar:deploy --activate"

.PHONY: db-migrate
db-migrate:
docker exec -it rewardengine-web bash -c "php artisan migrate"
Expand Down Expand Up @@ -55,13 +72,17 @@ logs:
logs-web:
docker compose logs -f --tail=100 rewardengine-web

.PHONY: logs-cardano-sidecar
logs-cardano-sidecar:
docker compose logs -f --tail=100 rewardengine-cardano-sidecar

.PHONY: shell
shell:
docker exec -it rewardengine-web bash

.PHONY: stats
stats:
docker stats rewardengine-web rewardengine-mysql rewardengine-redis
docker stats rewardengine-web rewardengine-mysql rewardengine-redis rewardengine-cardano-sidecar

.PHONY: artisan
artisan:
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
- Clone repo `git clone [email protected]:DripDropz/RewardEngine.git`
- Switch to repo dir `cd $HOME/Desktop/RewardEngine`
- Copy `.env.example` as `.env` (then make necessary changes to `.env` file)
- Run `make buid` to build & start the containers
- Run `make build` to build & start the containers
- Application should be running locally at `http://localhost:8200`

### Available Make Commands (Local Development)
* `frontend-build` Rebuild frontend
* `frontend-watch` Runs `npm run dev` (vite watch/hot-reload mode) inside _rewardengine-web_ container
* `frontend-upgrade` Upgrades npm packages inside _rewardengine-web_ container
* `up` Restart all docker containers
* `down` Shutdown all docker containers
* `build` Rebuilds all docker containers
Expand All @@ -26,6 +29,7 @@
* `status` View the status of all running containers
* `logs` View the logs out of all running containers
* `logs-web` View the logs out of `rewardengine-web` container only
* `logs-cardano-sidecar` View the logs out of `rewardengine-cardano-sidecar` container only
* `shell` Drop into an interactive shell inside _rewardengine-web_ container
* `stats` View the resource usage of all running containers
* `artisan` Execute Laravel `artisan` command inside _rewardengine-web_ container (e.g. usage: `make artisan COMMAND="make:model MyModel -m"`)
Expand Down
6 changes: 6 additions & 0 deletions application/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ TWITTER_CLIENT_SECRET=__UPDATE_ME__

GOOGLE_CLIENT_ID=__UPDATE_ME__
GOOGLE_CLIENT_SECRET=__UPDATE_ME__

SIDECAR_ACCESS_KEY_ID=__UPDATE_ME__
SIDECAR_SECRET_ACCESS_KEY=__UPDATE_ME__
SIDECAR_REGION=__UPDATE_ME__
SIDECAR_ARTIFACT_BUCKET_NAME=__UPDATE_ME__
SIDECAR_EXECUTION_ROLE=__UPDATE_ME__
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace App\Console\Commands;

use App\Jobs\HydraDoomEventParserJob;
use App\Models\EventData;
use App\Traits\LogExceptionTrait;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Throwable;

class SyncHydraDoomGlobalStatsCommand extends Command
{
use LogExceptionTrait;

private const PROJECT_ID = 1;
private const API_ENDPOINT = 'https://api.us-east-1.hydra-doom.sundae.fi/global_stats';

/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:sync-hydra-doom-global-stats-command';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Ingests hydra doom global stats';

/**
* Execute the console command.
*/
public function handle(): void
{
try {

$response = Http::timeout(30)
->connectTimeout(30)
->get(static::API_ENDPOINT)
->throw();

if ($response->successful()) {

$eventData = EventData::create([
'project_id' => static::PROJECT_ID,
'event_id' => Str::uuid()->toString(),
'timestamp' => time(),
'data' => [
'type' => 'global',
'stats' => $response->json(),
],
]);

dispatch(new HydraDoomEventParserJob($eventData));

}

} catch (Throwable $exception) {

$message = 'Failed to ingests hydra doom global stats';

$this->logException($message, $exception);

$this->error(sprintf('%s: %s', $message, $exception->getMessage()));

}
}
}
Loading

0 comments on commit 98f22fa

Please sign in to comment.