forked from bigbluebutton/greenlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implementing cronjob for deleting room and sending information email …
…to room owner
- Loading branch information
1 parent
b3cff86
commit 51325f8
Showing
8 changed files
with
100 additions
and
11,571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
echo "This is a script running every minute" >>/var/log/cron.log 2>&1 | ||
cd /usr/src/app || { | ||
echo "Failed to change directory to /usr/src/app" >>/var/log/cron.log 2>&1 | ||
exit 1 | ||
} | ||
|
||
./bin/rake rooms:delete_expired >>/var/log/cron.log 2>&1 | ||
echo "Finished rake task" >>/var/log/cron.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
version: '3' | ||
|
||
volumes: | ||
postgres-data: | ||
redis-data: | ||
|
||
|
||
services: | ||
postgres: | ||
image: postgres:14.6-alpine3.17 | ||
container_name: postgres | ||
db: | ||
image: postgres:14.8-alpine | ||
container_name: db | ||
restart: unless-stopped | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- ./data/postgres/14/database_data:/var/lib/postgresql/data | ||
- postgres-data:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD= | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
PGDATA: /var/lib/postgresql/data | ||
POSTGRES_HOST: db | ||
|
||
redis: | ||
image: redis:6.2-alpine3.17 | ||
image: redis:7.2.4-alpine | ||
container_name: redis | ||
restart: unless-stopped | ||
volumes: | ||
- ./data/redis/database_data:/data | ||
- redis-data:/data | ||
|
||
greenlight-v3: | ||
entrypoint: [bin/start] | ||
image: bigbluebutton/greenlight:v3 | ||
container_name: greenlight-v3 | ||
greenlight: | ||
image: my-greenlight-dev | ||
container_name: greenlight | ||
restart: unless-stopped | ||
env_file: .env | ||
ports: | ||
- 127.0.0.1:5050:3000 | ||
logging: | ||
driver: journald | ||
volumes: | ||
- ./data/greenlight-v3/storage:/usr/src/app/storage | ||
- "3000:3000" | ||
- "587:587" | ||
env_file: | ||
- .env | ||
depends_on: | ||
- postgres | ||
- db | ||
- redis | ||
logging: | ||
driver: "json-file" | ||
volumes: | ||
- ./app/javascript:/usr/src/app/app/javascript | ||
- ./log/cron.log:/var/log/cron.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace :rooms do | ||
desc "Delete rooms where deletion_date has passed" | ||
task delete_expired: :environment do | ||
expired_rooms = Room.where('deletion_date < ?', Time.current) | ||
|
||
if expired_rooms.any? | ||
size = expired_rooms.size | ||
expired_rooms.each do |room| | ||
begin | ||
room.notify_room_deletion | ||
room.destroy | ||
puts "Deleted room #{room.id}" | ||
rescue => e | ||
puts "Failed to delete room #{room.id}: #{e.message}" | ||
end | ||
end | ||
puts "Deleted #{size} expired rooms." | ||
else | ||
puts "No expired rooms to delete." | ||
end | ||
end | ||
end | ||
|
Oops, something went wrong.