Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
# TODO: We should remove this lfs once the first job runs and the DB is seeded with all the video files
lfs: true
lfs: false
fetch-depth: 1

- name: Remove a directory
run: rm -rf Forward-server/core/management/seed_data Forward-client

- name: Deploy to Server
uses: easingthemes/ssh-deploy@v5.1.0
Expand All @@ -33,10 +35,16 @@ jobs:
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
# TODO: After first job run, exclude the seed_data folder for bandwidth
EXCLUDE: "/Forward-client, .git/, .github/"
EXCLUDE: "Forward-client, .git/, .github/, Forward-server/core/management/seed_data/"
SCRIPT_AFTER: |
cd ${{ secrets.REMOTE_TARGET }}
cd "${{ secrets.REMOTE_TARGET }}"
echo "Rebuilding and restarting backend..."
docker-compose -f compose.production.yaml up -d --build backend
docker compose -f compose.production.yaml up -d --build backend

echo "Running database migrations..."
docker compose -f compose.production.yaml exec -T backend python manage.py migrate

echo "Collecting static files..."
docker compose -f compose.production.yaml exec -T backend python manage.py collectstatic --noinput --clear

docker image prune -f
2 changes: 1 addition & 1 deletion Forward-server/Dockerfile.Production
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ COPY . /app
EXPOSE 8000

# RUN python manage.py migrate
RUN python manage.py collectstatic --noinput
# RUN python manage.py collectstatic --noinput

CMD ["gunicorn", "--config", "gunicorn_config.py", "forward.wsgi:application"]
6 changes: 3 additions & 3 deletions Forward-server/core/admin/core_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CustomUserAdmin(UserAdmin):
None,
{
"classes": ("wide",),
"fields": ("username", "display_name","password", "password2", "facility"),
"fields": ("username", "display_name","password1", "password2", "facility"),
},
),
)
Expand Down Expand Up @@ -233,8 +233,8 @@ def content_view(self, obj):

def get_fields(self, request, obj=None):
if self.has_change_permission(request, obj):
return ("content",)
return ("content_view",)
return ("title","content",)
return ("title", "content_view",)

def get_readonly_fields(self, request, obj=None):
if not self.has_change_permission(request, obj):
Expand Down
5 changes: 3 additions & 2 deletions compose.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ services:
dockerfile: Dockerfile.Production
volumes:
- ./Forward-server:/app/server
- static_volume:/app/staticfiles
restart: unless-stopped
cpus: "0.85"
mem_limit: 750m
env_file:
- ../env_files/django/.env.production
networks:
- proxy
volumes:
- static_volume:/app/static

caddy:
image: caddy
Expand Down