Skip to content

Commit

Permalink
[DOC] update documentation with ena db init script
Browse files Browse the repository at this point in the history
  • Loading branch information
dameyerdave committed Jan 4, 2024
1 parent 422f025 commit 8b13aca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ services:
env_file: .env
volumes:
- pg_data:/var/lib/postgresql/data
- ./scripts/init_ena_db.sh:/docker-entrypoint-initdb.d/init_ena_db.sh
```

In the `.env` you need to configure the following values:
Expand All @@ -134,6 +135,20 @@ ENA_UPLOAD_FREQ_SECS=5
ENA_TOKEN=changeme
```

The database need to initialize the ena database with the correct username and password. This can be achieved using the following script as the `/docker-entrypoint-initdb.d/init_ena_db.sh`:

```bash
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER "$ENA_POSTGRES_USER";
ALTER USER "$ENA_POSTGRES_USER" PASSWORD '$ENA_POSTGRES_PASSWORD';
CREATE DATABASE "$ENA_POSTGRES_DB";
GRANT ALL PRIVILEGES ON DATABASE "$ENA_POSTGRES_DB" TO "$ENA_POSTGRES_USER";
EOSQL
```

## Usage

### Submit a study
Expand Down

0 comments on commit 8b13aca

Please sign in to comment.