First deployment
This commit is contained in:
26
deploy.sh
Executable file
26
deploy.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
HOST=peakup-backend
|
||||
REMOTE_APP_DIR=/opt/peakup/app
|
||||
SERVICE=peakup
|
||||
|
||||
echo "==> Building..."
|
||||
cd peakup-backend
|
||||
JAVA_HOME=/home/ingo/.jdks/temurin-21.0.7 \
|
||||
./mvnw -s /home/ingo/.m2/settings_peak.xml \
|
||||
-Dmaven.repo.local=/home/ingo/.m2/peak-repo \
|
||||
package -DskipTests
|
||||
cd ..
|
||||
|
||||
echo "==> Stopping service on $HOST..."
|
||||
ssh root@$HOST "systemctl stop $SERVICE"
|
||||
|
||||
echo "==> Deploying..."
|
||||
rsync -av --delete peakup-backend/target/quarkus-app/ root@$HOST:$REMOTE_APP_DIR/
|
||||
|
||||
echo "==> Fixing permissions and starting service..."
|
||||
ssh root@$HOST "chown -R peakup:peakup $REMOTE_APP_DIR && systemctl start $SERVICE"
|
||||
|
||||
echo "==> Done. Tailing logs (Ctrl+C to exit)..."
|
||||
ssh root@$HOST "journalctl -u $SERVICE -f"
|
||||
@@ -14,6 +14,7 @@ import jakarta.annotation.Nullable;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
@@ -55,6 +56,9 @@ public class IntervalsActivityImporter
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
IntervalsActivityImporter self; // CDI proxy — enables @Transactional on persistSingle()
|
||||
|
||||
@ConfigProperty(name = "peakup.stream-import.delay-ms", defaultValue = "1000")
|
||||
long streamImportDelayMs;
|
||||
|
||||
@Override
|
||||
protected AbstractDAO<IntervalsActivity> getDAO() {
|
||||
return intervalsActivityDAO;
|
||||
@@ -360,6 +364,14 @@ public class IntervalsActivityImporter
|
||||
if (done % 100 == 0) {
|
||||
log.info("Stream import progress: {} / {}", done, total);
|
||||
}
|
||||
if (streamImportDelayMs > 0 && i < total - 1) {
|
||||
try {
|
||||
Thread.sleep(streamImportDelayMs);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
quarkus.datasource.jdbc.url=jdbc:postgresql://10.8.11.116:5432/peakup
|
||||
quarkus.log.file.enable=true
|
||||
quarkus.log.file.path=/opt/peakup/logs/peakup.log
|
||||
quarkus.log.file.level=INFO
|
||||
quarkus.log.file.rotation.max-file-size=10M
|
||||
quarkus.log.file.rotation.max-backup-index=5
|
||||
@@ -18,3 +18,5 @@ strava-api/mp-rest/url=https://www.strava.com
|
||||
|
||||
# intervals.icu
|
||||
intervals-api/mp-rest/url=https://intervals.icu
|
||||
|
||||
peakup.stream-import.delay-ms=1000
|
||||
|
||||
19
peakup.service
Normal file
19
peakup.service
Normal file
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=PeakUp Backend (Quarkus)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=peakup
|
||||
WorkingDirectory=/opt/peakup/app
|
||||
ExecStart=/usr/bin/java \
|
||||
--enable-native-access=ALL-UNNAMED \
|
||||
-Dquarkus.profile=prod \
|
||||
-jar /opt/peakup/app/quarkus-run.jar
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,22 +1,20 @@
|
||||
-- Athlete and Strava Connector seed data for Ingo and Mirja Schnabel
|
||||
-- Generated from local database on 2026-03-08
|
||||
|
||||
-- Athletes
|
||||
INSERT INTO athlete (id, first_name, last_name, weight, sex, created_at, modified_at)
|
||||
VALUES (90, 'Ingo', 'Schnabel', 93, NULL, '2025-12-29 18:40:14.968397+00', '2025-12-29 18:40:14.968397+00'),
|
||||
(91, 'Mirja', 'Schnabel', 50, NULL, '2026-01-17 16:44:40.548585+00', '2026-01-17 16:44:40.548585+00');
|
||||
INSERT INTO athlete (id, first_name, last_name, login, weight, sex, created_at, modified_at)
|
||||
VALUES (90, 'Ingo', 'Schnabel', 'ingo', 93, NULL, '2025-12-29 18:40:14.968397+00', '2025-12-29 18:40:14.968397+00'),
|
||||
(91, 'Mirja', 'Schnabel', 'mirja', 50, NULL, '2026-01-17 16:44:40.548585+00', '2026-01-17 16:44:40.548585+00');
|
||||
|
||||
-- Strava Connectors
|
||||
INSERT INTO strava_connector (id, athlete_id, strava_athlete_id, access_token, refresh_token, expires_at, client_id,
|
||||
client_secret, created_at, modified_at)
|
||||
VALUES (91, 90, '36523216', '12c757d282015eb26c21117c3a9a561b038ad2cb', '685ae77fcc95c4349231d9cd2657c4dc5ebb2388',
|
||||
VALUES (nextval('global_id_seq'), 90, '36523216', '12c757d282015eb26c21117c3a9a561b038ad2cb',
|
||||
'685ae77fcc95c4349231d9cd2657c4dc5ebb2388',
|
||||
1773023973, '116054', '59459bc900769ab3bb20d0ece6f3552b51d969ea', '2025-12-29 18:40:31.367635+00',
|
||||
'2026-03-08 20:39:33.608005+00'),
|
||||
(1530, 91, '108631588', 'f6ae8f13bc259339a417089c5d39e134d3fafb01', '4cce30a1b809a35180415c2c047bedaa2c2b2ddc',
|
||||
(nextval('global_id_seq'), 91, '108631588', 'f6ae8f13bc259339a417089c5d39e134d3fafb01',
|
||||
'4cce30a1b809a35180415c2c047bedaa2c2b2ddc',
|
||||
1773023974, '196530', '9c251d9add6a46b4af26d371108bfb84d42f2ec8', '2026-01-17 16:44:42.889363+00',
|
||||
'2026-03-08 20:39:35.183066+00');
|
||||
|
||||
-- Intervals Connectors
|
||||
INSERT INTO intervals_connector (id, athlete_id, intervals_athlete_id, api_key, created_at, modified_at)
|
||||
VALUES (nextval('global_id_seq'), 90, 'use athlet', '', now(), now()),
|
||||
(nextval('global_id_seq'), 91, 'i310361', '7er8wec6ziuaitp6nrw6wteqf', now(), now());
|
||||
VALUES (nextval('global_id_seq'), 90, 'i157824', '38he2acw5nakpy749jabprdtz', now(), now()),
|
||||
(nextval('global_id_seq'), 91, 'i310361', '7er8wec6ziuaitp6nrw6wteqf', now(), now());
|
||||
Reference in New Issue
Block a user