I am trying to build CI/CD environment using github action.
Below script helps me to build the docker image, but returning an error
localhost can successfully migrate the database without any errors. However, when I use github action, it fails.
Maybe I should try manipulating firewalls from digital ocean or github? If you have any suggestion, please let me know.
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_ID: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_ID -p $DOCKER_PASSWORD
- name: docker build
run: |
docker rmi --force "dummy/dummy-community:latest"
docker build -t polls .
- name: docker migrate
run: |
docker run --env-file env polls sh -c "python manage.py makemigrations && python manage.py migrate"
- name: docker tag image
run: |
docker tag polls:latest dummy/dummy-community:latest
- name: docker push
run: |
docker push dummy/dummy-community:latest
- name: kubectl deploy
run: |
kubectl delete pods polls-app
kubectl get deploy polls-app
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This comment has been deleted
The error Operation timed out error can happen when current machine or resource won’t allow to connect which was stated from the below link.
https://www.digitalocean.com/docs/databases/postgresql/resources/troubleshoot-connections/
Also, I have added services for postgres to wait until it starts before running the migration.
https://docs.github.com/en/actions/guides/creating-postgresql-service-containers
I have tried opening TCP port from ssh, but still not working.