|
|
|
|
@ -30,3 +30,68 @@ Everyone can apply to be a recipe maintainer:
|
|
|
|
|
1. Watch the repository to always get updates
|
|
|
|
|
2. Simply add your self to the list in the [README.md](./README.md) and open a new pull request with the change.
|
|
|
|
|
3. Once the pull request gets merged you will be added to the [loomio maintainers team](https://git.coopcloud.tech/org/coop-cloud/teams/loomio-maintainers).
|
|
|
|
|
|
|
|
|
|
# Testing Loomio Changes
|
|
|
|
|
|
|
|
|
|
As a maintainer, it is helpful to have a dev environment to test changes. One can easily be created in the usual way with `abra app new loomio`, but to test changes and upgrades it's good to have a database with a bunch of test data.
|
|
|
|
|
|
|
|
|
|
## Populating with test data
|
|
|
|
|
|
|
|
|
|
You can either make some artificial test data, or import test data from an existing Loomio instance. https://help.loomio.com/en/user_manual/groups/data_export/index.html is super helpful here. Here's a summary:
|
|
|
|
|
|
|
|
|
|
1. Export existing data from a running instance by having an admin go to a group and click [the "Export group data" settings option](https://help.loomio.com/en/user_manual/groups/data_export/index.html#export-data)
|
|
|
|
|
|
|
|
|
|
2. Fully deploy a clean test instance of Loomio. Note: importing might not work well on a database that has data in it, so you might want to wipe your test instance when doing an import, if it already has data in it
|
|
|
|
|
|
|
|
|
|
3. Copy the json into the Loomio `app` container by doing
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[local] $ scp loomio-testdata.json username@your-domain.org:loomio-deploy/import/
|
|
|
|
|
[local] $ ssh username@your-domain.org
|
|
|
|
|
[your-domain.org] $ docker ps | grep loomio | grep app # note down the loomio app container id
|
|
|
|
|
[your-domain.org] $ sudo docker cp ~/loomio-deploy/import/loomio-testdata.json <loomio-app-container-id>:/import/loomio-testdata.json
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
4. Set up your rails tools
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[your-domain.org] $ docker exec -it <loomio-app-container-id> bash
|
|
|
|
|
[loomio] $ DB_PASS="$(cat /run/secrets/db_password)"
|
|
|
|
|
[loomio] $ echo "production:
|
|
|
|
|
adapter: postgresql
|
|
|
|
|
host: db
|
|
|
|
|
database: loomio_production
|
|
|
|
|
username: postgres
|
|
|
|
|
password: ${DB_PASS}
|
|
|
|
|
port: 5432" > config/database.yml
|
|
|
|
|
|
|
|
|
|
[loomio] $ cd /loomio && RAILS_ENV=production EDITOR=vi bundle exec rails credentials:edit
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
5. Process the Loomio test data export, to get it into your dev instance's database:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[loomio] $ rails console
|
|
|
|
|
|
|
|
|
|
[loomio][rails] > GroupExportService.import('/import/loomio-testdata.json')
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Manipulating the loomio db
|
|
|
|
|
|
|
|
|
|
If you want to drop your loomio db(!!), you can do so by logging in to the `db` container:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[your-domain.org] $ docker ps | grep loomio | grep _db # find your loomio _db_ container id
|
|
|
|
|
[your-domain.org] $ docker exec -it <loomio-db-container-id> bash
|
|
|
|
|
[loomio-db] # su postgres
|
|
|
|
|
[loomio-db] $ dropdb loomio_production
|
|
|
|
|
[loomio-db] $ createdb loomio_production
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
From here, you can do something like recreate it, from the app container:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[your-domain.org] $ docker ps | grep loomio | grep app # find your loomio app container id
|
|
|
|
|
[your-domain.org] $ docker exec -it <loomio-app-container-id> bash
|
|
|
|
|
[loomio-app] $ rake db:setup # you may have to run through step 4 from earlier
|
|
|
|
|
```
|