Code Monkey home page Code Monkey logo

supa-backup's Introduction

Hi there ๐Ÿ‘‹

My name is Rodrigo Mansueli, and I am a Support Engineer with experience in the tech industry. With a Master's Degree in Computer Engineering and a Bachelor's Degree in Computer Science, I have developed a strong technical background and knowledge of programming languages such as Python and SQL. In my current role, I work closely with customers to provide exceptional technical support and help them troubleshoot issues with software and hardware systems. I am passionate about customer service and always strive to go above and beyond to exceed their expectations. I am excited to connect with other professionals in the industry and look forward to learning from and collaborating with others.

Mansueli's GitHub stats

Mansueli's SO profile

Mansueli's SO ranking for Java Mansueli's SO ranking for Python

supa-backup's People

Contributors

mansueli avatar reorx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

reorx

supa-backup's Issues

pg_dump: error: invalid integer value "https:" for connection option "port"

@mansueli I got the following error when trying to run this...

(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 220255 files and directories currently installed.)
Preparing to unpack .../postgresql-client-common_250.pgdg22.04+1_all.deb ...
Unpacking postgresql-client-common (250.pgdg22.04+1) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../postgresql-common_250.pgdg22.04+1_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (250.pgdg22.04+1) ...
Selecting previously unselected package postgresql-client-15.
Preparing to unpack .../postgresql-client-15_15.3-1.pgdg22.04+1_amd64.deb ...
Unpacking postgresql-client-15 (15.3-1.pgdg22.04+1) ...
Selecting previously unselected package postgresql-15.
Preparing to unpack .../postgresql-15_15.3-1.pgdg22.04+1_amd64.deb ...
Unpacking postgresql-15 (15.3-1.pgdg22.04+1) ...
Setting up postgresql-client-common (250.pgdg22.04+1) ...
Setting up postgresql-client-15 (15.3-1.pgdg22.04+1) ...
update-alternatives: using /usr/share/postgresql/15/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-common (250.pgdg22.04+1) ...
'/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg' -> '/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg'
postgresql.service is a disabled or a static unit, not starting it.
Setting up postgresql-15 (15.3-1.pgdg22.04+1) ...
Creating new PostgreSQL cluster 15/main ...
/usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main --auth-local peer --auth-host scram-sha-256 --no-instructions
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/15/main ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Processing triggers for man-db (2.10.2-1) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 5.15.0-1038-azure
NEEDRESTART-KEXP: 5.15.0-1038-azure
NEEDRESTART-KSTA: 1
pg_dump: error: invalid integer value "https:" for connection option "port"
Error: Process completed with exit code 1.```

Not possible to use this action with secrets

Right now it is only possible to use secrets when using the full workflow directly i.e:

name: Supa-backup
# Controls when the workflow will run
on:
  # Allows you to run this workflow manually from the Actions tab
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *' # Runs every day at midnight
    
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:   
 run_db_backup:
  runs-on: ubuntu-latest
  permissions:
      # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
      contents: write
  steps:
     - uses: actions/checkout@v3
       with:
         ref: ${{ github.head_ref }}
     - name: Postgres15 
       run: |
         sudo apt-get remove postgresql-client-common
         sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
         wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
         sudo apt update
         sudo apt install postgresql-15 postgresql-client-15 -y
         /usr/lib/postgresql/15/bin/pg_dump --clean --if-exists --quote-all-identifiers --schema '*' --exclude-schema 'extensions|graphql|graphql_public|net|pgbouncer|pgsodium|pgsodium_masks|realtime|supabase_functions|storage|pg_*|information_schema' -d postgres://postgres:${{ secrets.SUPABASE_PASSWORD }}@${{ secrets.SUPABASE_URL }}:6543/postgres > dump.sql
         
     - name: Tweaking the dump file    
       run: |
         sed -i -e 's/^DROP SCHEMA IF EXISTS "auth";$/-- DROP SCHEMA IF EXISTS "auth";/' dump.sql
         sed -i -e 's/^DROP SCHEMA IF EXISTS "storage";$/-- DROP SCHEMA IF EXISTS "storage";/' dump.sql
         sed -i -e 's/^CREATE SCHEMA "auth";$/-- CREATE SCHEMA "auth";/' dump.sql
         sed -i -e 's/^CREATE SCHEMA "storage";$/-- CREATE SCHEMA "storage";/' dump.sql
         sed -i -e 's/^ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin"/-- ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin"/' dump.sql
       shell: bash   

     - uses: stefanzweifel/git-auto-commit-action@v4
       with:
         commit_message: Supabase backup

If you try to use it just with the GitHub actions, then it fails:

name: Supa-Backup
on:
  # Allows you to run this workflow manually from the Actions tab
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *' # Runs every day at midnight
jobs:
  backup:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Supa-Backup
        uses: mansueli/[email protected]
        with:
          supabase_url: {{secrets.SUPABASE_URL}}
          supabase_password: {{secrets.SUPABASE_PASSWORD}}
      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Supabase backup

Error:

pg_dump: error: could not translate host name "***" to address: Temporary failure in name resolution
Error: Process completed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.