Skip to content

Commit

Permalink
Merge pull request #141 from ledgerleapllc/staging
Browse files Browse the repository at this point in the history
Sync staging to master
  • Loading branch information
ledgerleapllc authored Dec 7, 2022
2 parents f791dac + 9f74119 commit b8b9d0a
Show file tree
Hide file tree
Showing 148 changed files with 7,090 additions and 5,357 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/loca
# Load php_gmp extension
echo "extension=php_gmp.so" | sudo tee /etc/php/7.4/mods-available/ext_gmp.ini
sudo ln -s /etc/php/7.4/mods-available/ext_gmp.ini /etc/php/7.4/cli/conf.d/20-ext_gmp.ini

# Configure Horizon
php artisan queue:table
php artisan migrate
## Install Redis. Link: https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-20-04
composer require predis/predis
composer require laravel/horizon
php artisan horizon:install
php artisan horizon:publish
## Configure Supervisor. Link: https://laravel.com/docs/9.x/horizon#installing-supervisor ( Only 'Installing Supervisor', 'Supervisor Configuration', 'Starting Supervisor' Sections )
```

Setup the repo according to our VHOST path. Note, the actual VHOST path in this case should be set to **/var/www/CasperAssociationPortalBackend/public**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ packages:
- php7.4-curl
- php7.4-xml
- php7.4-gmp
- redis-server
- supervisor


php:
Expand Down
12 changes: 11 additions & 1 deletion ansible/roles/casper-association-portal-backend/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
cron:
name: "{{ app.name }}"
user: "{{ security.app_user }}"
job: "cd /var/www/server && php artisan schedule:run 2>&1"
job: "cd /var/www/server && sudo php artisan schedule:run 2>&1"
minute: "*"
hour: "*"
day: "*"
Expand Down Expand Up @@ -266,3 +266,13 @@
- config
- first_setup
when: clone_repo.changed

- name: Horizon
shell: sudo supervisorctl reread && sudo supervisorctl update && sudo service supervisor restart
args:
chdir: "{{ app.home }}"
tags:
- php
- update
- horizon
when: clone_repo.changed
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ DB_PASSWORD={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_DB_PASSWORD') }}
BROADCAST_DRIVER={{ broadcast.driver }}
CACHE_DRIVER={{ cache.driver }}
FILESYSTEM_DRIVER={{ filesystem.driver }}
QUEUE_CONNECTION={{ queue.connection }}
QUEUE_CONNECTION=redis
SESSION_DRIVER={{ session.driver }}
SESSION_LIFETIME={{ session.lifetime }}

MEMCACHED_HOST={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_MEMCACHED_HOST') }}

REDIS_CLIENT=predis
REDIS_HOST={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_REDIS_HOST') }}
REDIS_PASSWORD={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_REDIS_PASSWORD') }}
REDIS_PORT={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_REDIS_PORT') }}
Expand All @@ -34,7 +35,7 @@ MAIL_USERNAME={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_MAIL_USERNAME'
MAIL_PASSWORD={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_MAIL_PASSWORD') }}
MAIL_ENCRYPTION={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_MAIL_ENCRYPTION') }}
MAIL_FROM_ADDRESS={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_MAIL_FROM_ADDRESS') }}
MAIL_FROM_NAME="{{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_MAIL_FROM_NAME') }}"
MAIL_FROM_NAME="{{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_APP_NAME') }}"

AWS_ACCESS_KEY_ID={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_AWS_KEY') }}
AWS_SECRET_ACCESS_KEY={{ lookup('ansible.builtin.env', 'CA_MEMBER_PORT_BE_AWS_SECRET') }}
Expand Down
8 changes: 5 additions & 3 deletions app/Console/Commands/CheckBallot.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Console\Commands;

use App\Console\Helper;
use App\Models\Ballot;
use Carbon\Carbon;
use Illuminate\Console\Command;
Expand Down Expand Up @@ -39,10 +40,11 @@ public function __construct()
*/
public function handle()
{
$settings = getSettings();
$settings = Helper::getSettings();
$quorumRate = $settings['quorum_rate_ballot'] ?? 50;
$now = Carbon::now('UTC');
$ballots = Ballot::with(['vote'])->where('status', 'active')->where('time_end', '<=', $now)->get();
$ballots = Ballot::with(['vote'])->where('status', 'active')
->where('time_end', '<=', Carbon::now('UTC'))
->get();
foreach ($ballots as $ballot) {
$vote = $ballot->vote;
if ($vote->result_count == 0) {
Expand Down
37 changes: 37 additions & 0 deletions app/Console/Commands/CheckBallot2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace App\Console\Commands;

use App\Console\Helper;
use App\Models\Ballot;
use App\Jobs\BallotReminder24;
use Carbon\Carbon;

use Illuminate\Console\Command;

class CheckBallot2 extends Command
{
protected $signature = 'ballot:check2';
protected $description = 'Ballot Check 2';

public function __construct() {
parent::__construct();
}

public function handle() {
$ballots = Ballot::with(['vote', 'voteResults'])
->where('status', 'active')
->where('time_end', '<=', Carbon::now('UTC')->addHours(24))
->where('time_end', '>', Carbon::now('UTC'))
->where('reminder_24_sent', false)
->orderBy('time_end', 'asc')
->get();

if ($ballots && count($ballots) > 0) {
foreach ($ballots as $ballot) {
BallotReminder24::dispatch($ballot)->onQueue('default_long');
}
}

return 0;
}
}
Loading

0 comments on commit b8b9d0a

Please sign in to comment.