Skip to content

Commit 33ff74d

Browse files
committed
chore: updated deployment process
1 parent f8a985d commit 33ff74d

3 files changed

Lines changed: 35 additions & 17 deletions

File tree

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ RUN set -ex && \
2222
rm -rf /root/.cache/
2323
COPY . /app
2424

25+
# Copy and set entrypoint
26+
COPY entrypoint.sh /entrypoint.sh
27+
RUN chmod +x /entrypoint.sh
28+
2529
EXPOSE 8000
2630

27-
CMD ["gunicorn","--bind",":8000","--workers","2","--worker-class","uvicorn.workers.UvicornWorker","paycore.asgi:application"]
31+
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]

entrypoint.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
set -e
3+
4+
echo "Running migrations..."
5+
python manage.py migrate --noinput
6+
7+
echo "Collecting static files..."
8+
python manage.py collectstatic --noinput --clear
9+
10+
echo "Seeding users..."
11+
python manage.py seed_users
12+
13+
echo "Upserting countries..."
14+
python manage.py upsert_countries
15+
16+
echo "Seeding bill providers..."
17+
python manage.py seed_bill_providers
18+
19+
echo "Seeding loan products..."
20+
python manage.py seed_loan_products
21+
22+
echo "Seeding investment products..."
23+
python manage.py seed_investment_products
24+
25+
echo "Seeding FAQs..."
26+
python manage.py seed_faqs
27+
28+
echo "Starting Gunicorn..."
29+
exec gunicorn --bind :8000 --workers 1 --worker-class uvicorn.workers.UvicornWorker --timeout 120 --max-requests 1000 --max-requests-jitter 100 paycore.asgi:application

fly.toml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,16 @@ console_command = '/app/manage.py shell'
1010
[build]
1111

1212
[deploy]
13-
release_command = 'sh -c "python manage.py collectstatic --noinput && python manage.py migrate --noinput"'
1413

1514
[env]
1615
PORT = '8000'
1716

18-
[processes]
19-
# Reduced to 1 worker to minimize memory usage on basic tier
20-
app = 'gunicorn --bind :8000 --workers 1 --worker-class uvicorn.workers.UvicornWorker --timeout 120 --max-requests 1000 --max-requests-jitter 100 paycore.asgi:application'
21-
# Reduced concurrency for Celery to save memory
22-
celery = 'celery -A paycore worker --loglevel=warning --concurrency=1 --max-tasks-per-child=100'
23-
2417
[http_service]
2518
internal_port = 8000
2619
force_https = true
2720
auto_stop_machines = 'suspend'
2821
auto_start_machines = true
2922
min_machines_running = 0
30-
processes = ['app']
3123

3224
# Add health checks to prevent premature restarts
3325
[[http_service.checks]]
@@ -42,14 +34,7 @@ console_command = '/app/manage.py shell'
4234
memory = '512mb'
4335
cpu_kind = 'shared'
4436
cpus = 1
45-
processes = ['app']
46-
47-
[[vm]]
48-
memory = '256mb'
49-
cpu_kind = 'shared'
50-
cpus = 1
51-
processes = ['celery']
5237

5338
[[statics]]
54-
guest_path = '/app/static'
39+
guest_path = '/app/staticfiles'
5540
url_prefix = '/static/'

0 commit comments

Comments
 (0)