Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into build/transpil…
Browse files Browse the repository at this point in the history
…e-bundle-backend-esbuild
  • Loading branch information
LarsTheGlidingSquirrel committed Sep 30, 2024
2 parents a55b07a + 6273244 commit 4e80143
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 94 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-to-uberspace-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Deploy to Server
uses: easingthemes/[email protected].0
uses: easingthemes/[email protected].1
with:
ARGS: '-rlgoDzvc -i --delete'
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-to-uberspace-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Deploy to Server
uses: easingthemes/[email protected].0
uses: easingthemes/[email protected].1
with:
ARGS: '-rlgoDzvc -i --delete'
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@
"mysql2": "^3.11.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tsx": "4.19.0",
"typescript": "^5.5.4",
"tsx": "4.19.1",
"typescript": "^5.6.2",
"uuid": "^10.0.0"
},
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.10.0",
"@eslint/js": "^9.11.1",
"@types/jsonwebtoken": "9.0.6",
"@types/ltijs": "4.0.11",
"@types/node": "^22.7.2",
"@types/node": "^22.7.4",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitejs/plugin-react-swc": "^3.7.1",
"esbuild": "^0.24.0",
"eslint": "^9.10.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.12",
"globals": "^15.9.0",
Expand Down
14 changes: 14 additions & 0 deletions scripts/setup_uberspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,17 @@ if ! $(uberspace web backend list | grep -q 'http:3000 => OK, listening'); then
exit 2
fi
echo 'Backend app opened to the internet'

# Only on 'production' environment
if [ "$USER" = "edtr" ]; then
# IMPORTANT: This completely overwrites existing cronjob entries!
crontab ~/serlo-editor-as-lti-tool/uberspace/backup_cron
echo 'Added cronjob for database backups'

echo 'Configuring IONOS S3 for database backups'
s3cmd --configure

echo 'Available buckets:'
s3cmd ls
echo 'Create bucket serlo-test-database-backup manually if it does not appear here.'
fi
6 changes: 6 additions & 0 deletions uberspace/backup_cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Disable sending all cronjob results, send only errors
# https://manual.uberspace.de/daemons-cron/#mails
MAILTO=""

# See https://crontab.guru/ for schedule
0 2 * * * /bin/bash ~/serlo-editor-as-lti-tool/uberspace/backup_database.sh
12 changes: 12 additions & 0 deletions uberspace/backup_database.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set -e

timestamp="$(date '+%Y-%m-%d-%H-%M-%S')"
file="/home/${USER}/$timestamp.sql"

mysqldump ${USER} > $file

s3cmd put $file s3://serlo-test-database-backup

rm $file

echo 'Successfully backed up database on IONOS'
Loading

0 comments on commit 4e80143

Please sign in to comment.