Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for importing a data download in a Docker Compose dev env #4120

Merged
merged 3 commits into from
Dec 7, 2024

Conversation

neolefty
Copy link
Contributor

Documentation only.

  • Are these instructions correct?
    • They are tested, but is there a better way?
  • Is this a good (or only) place to put the documentation?

@LocoDelAssembly
Copy link
Contributor

LocoDelAssembly commented Nov 19, 2024

docker compose exec db psql -U postgres -d taxonworks_development -f /mnt/unzip/dump.sql

I believe you can just send through stdin and save yourself from adding another volume:

docker compose exec db psql -U postgres -d taxonworks_development -f - < local/path/dump.sql

Here there is an example with pg_restore (doesn't work with sql files)

[edit]Corrected link

@neolefty
Copy link
Contributor Author

neolefty commented Nov 20, 2024

docker compose exec db psql -U postgres -d taxonworks_development -f /mnt/unzip/dump.sql

I believe you can just send through stdin and save yourself from adding another volume:

docker compose exec db psql -U postgres -d taxonworks_development -f - < local/path/dump.sql

https://github.com/SpeciesFileGroup/install_taxonworks/tree/master/development/docker#restore-a-database-dump there is an example with pg_restore (doesn't work with sql files)

Thanks for the suggestion — that would be better.

However, I tried that but didn't get it to work:

$ echo "select count(id) from users;" > foo.sql
$ docker compose exec db psql -U postgres -d taxonworks_development -f - < foo.sql
WARN[0000] /Users/wbbaker/source/taxonworks/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
the input device is not a TTY

Update: Found a solution: docker compose exec --no-TTY.

$ docker compose exec --no-TTY db psql -U postgres -d taxonworks_development -f - < ./foo.sql
WARN[0000] /Users/wbbaker/source/taxonworks/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
 count 
-------
   876
(1 row)

PR updated.

@LocoDelAssembly
Copy link
Contributor

As discussed in SpeciesFileGroup/taxonworks_doc#94 (comment) perhaps such warning should also appear here. Text might become too big already and perhaps we should consider linking to docs for ways on restoring dumps instead of keep expanding.

Other than that, the instructions in this PR are correct. Perhaps we can merge, then refactor to link to docs with more use cases and extended explanation.

@LocoDelAssembly LocoDelAssembly requested a review from mjy December 3, 2024 01:18
@mjy
Copy link
Member

mjy commented Dec 3, 2024

Perhaps we can merge, then refactor to link to docs with more use cases and extended explanation.

Agreed. We'll merge this after 0.46.0 release.

We need some cannonical way to store linkages between app and documentation endpoints, maybe a config file that lets us introduce help tags pointing to help keywords, perhaps something likeK

# config/initializers/help_index.yml
---
help_keyword: 
  url: 
keyword_keyword2: 
  url:

<%= help_link(help_keyword) %>

or

/help/:keyword to get the JSON response to inject the link.

@mjy mjy merged commit 8a33c47 into SpeciesFileGroup:development Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants