cdborinstein commited on
Commit
f62552c
·
1 Parent(s): 934dccb

Add database migrations and user creation

Browse files
Files changed (1) hide show
  1. start.sh +13 -0
start.sh CHANGED
@@ -1,5 +1,18 @@
1
  #!/bin/bash
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  # Start backup script in background (only if HF_TOKEN is set)
4
  if [ -n "$HF_TOKEN" ]; then
5
  python /app/backup_to_hub.py &
 
1
  #!/bin/bash
2
 
3
+ # Initialize database (run migrations)
4
+ echo "Running database migrations..."
5
+ python -m argilla_server database migrate
6
+
7
+ # Create default user if USERNAME and PASSWORD are set
8
+ if [ -n "$USERNAME" ] && [ -n "$PASSWORD" ]; then
9
+ echo "Creating admin user..."
10
+ python -m argilla_server database users create \
11
+ --username "$USERNAME" \
12
+ --password "$PASSWORD" \
13
+ --role owner || echo "User may already exist, continuing..."
14
+ fi
15
+
16
  # Start backup script in background (only if HF_TOKEN is set)
17
  if [ -n "$HF_TOKEN" ]; then
18
  python /app/backup_to_hub.py &