-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update image versions and configurations
* Updated nginx version * Updated nginx conf for https traffic * Updated postgres version from 9.6 to 13 * Updated elasticsearch version to 2.4.6 * Updated elasticsearch configuration to allow scripting * Added two updated elasticsearch mappings and mounts for them
- Loading branch information
1 parent
b1bd7d4
commit a48f933
Showing
9 changed files
with
227 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM elasticsearch:2.2 | ||
FROM elasticsearch:2.4.6 | ||
EXPOSE 9200 9300 | ||
|
||
RUN cd /usr/share/elasticsearch && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
network.host: 0.0.0.0 | ||
script.inline: on | ||
script.indexed: on |
66 changes: 66 additions & 0 deletions
66
elasticsearch/mappings/file-download/file-download-v1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"template": "events-stats-file-download-*", | ||
"settings": { | ||
"index": { | ||
"refresh_interval": "5s" | ||
} | ||
}, | ||
"mappings": { | ||
"_default_": { | ||
"dynamic_templates": [ | ||
{ | ||
"date_fields": { | ||
"match_mapping_type": "date", | ||
"mapping": { | ||
"type": "date", | ||
"format": "strict_date_hour_minute_second" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"file-download": { | ||
"_source": { | ||
"enabled": false | ||
}, | ||
"_all": { | ||
"enabled": false | ||
}, | ||
"date_detection": false, | ||
"numeric_detection": false, | ||
"properties": { | ||
"timestamp": { | ||
"type": "date", | ||
"format": "strict_date_hour_minute_second" | ||
}, | ||
"bucket_id": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"file_id": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"file_key": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"unique_id": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"visitor_id": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"collection": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
} | ||
} | ||
} | ||
}, | ||
"aliases": { | ||
"events-stats-file-download": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"template": "events-stats-record-view-*", | ||
"settings": { | ||
"index": { | ||
"refresh_interval": "5s" | ||
} | ||
}, | ||
"mappings": { | ||
"record-view": { | ||
"_source": { | ||
"enabled": false | ||
}, | ||
"_all": { | ||
"enabled": false | ||
}, | ||
"date_detection": false, | ||
"numeric_detection": false, | ||
"properties": { | ||
"timestamp": { | ||
"type": "date", | ||
"format": "strict_date_hour_minute_second" | ||
}, | ||
"record_id": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"pid_type": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"pid_value": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"labels": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"visitor_id": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
}, | ||
"community": { | ||
"type": "string", | ||
"index": "not_analyzed" | ||
} | ||
} | ||
} | ||
}, | ||
"aliases": { | ||
"events-stats-record-view": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM nginx:1.18 | ||
FROM nginx:mainline-alpine | ||
EXPOSE 80 443 | ||
|
||
RUN rm /etc/nginx/conf.d/*.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Upgrade guide for POSTGRESQL | ||
|
||
From 9.6 to 13 | ||
|
||
**Step 1: Get a database dump** | ||
|
||
With a running stack before upgrade: | ||
|
||
```bash | ||
docker-compose exec postgres pg_dump --blobs --clean --dbname="${DBNAME}" --username="${DBUSER}" | gzip > dumpfile.sql.gz | ||
``` | ||
|
||
**Step 2: DELETE old db** | ||
|
||
With a running stack before upgrade: | ||
|
||
```bash | ||
docker container ls --filter name=<COMPOSE_PROJECT_NAME>_postgres_1 --format {{.ID}} | ||
``` | ||
|
||
Variable `COMPOSE_PROJECT_NAME` is define in the .env file of the project. If the env variable is not define, the default value is the name of the folder where the .yml file is built. | ||
|
||
```bash | ||
docker exec -i <CONTAINER ID POSTGRES> psql --user <B2SHARE_POSTGRESQL_USER> postgres -c 'DROP database <B2SHARE_POSTGRESQL_DBNAME>' | ||
``` | ||
|
||
**Step 3: Upgrade postgres** | ||
|
||
New version of postgres is defined in the `docker-compose.yml` file. Thus, you only need to run: | ||
|
||
```bash | ||
docker-compose up -d postgres | ||
``` | ||
|
||
**Step 4: Recreate database** | ||
|
||
With a running stack after upgrade: | ||
|
||
Get ID of the recreated container (Same as in step 2): | ||
|
||
```bash | ||
docker container ls --filter name=<COMPOSE_PROJECT_NAME>_postgres_1 --format {{.ID}} | ||
``` | ||
|
||
```bash | ||
docker exec -i <CONTAINER ID POSTGRES> psql --user <B2SHARE_POSTGRESQL_USER> postgres -c 'CREATE database <B2SHARE_POSTGRESQL_DBNAME>' | ||
``` | ||
|
||
**Step 5: Restore data** | ||
|
||
With a running stack after upgrade: | ||
|
||
```bash | ||
# Uncompressed .sql file: | ||
docker exec -i <CONTAINER ID> psql --user <B2SHARE_POSTGRESQL_USER> <B2SHARE_POSTGRESQL_DBNAME> < <ABSOLUTE_PATH_TO_DB_BACKUP> | ||
# Gzip compressed .sql.gz file: | ||
zcat <ABSOLUTE_PATH_TO_DB_BACKUP> | docker exec -i <CONTAINER ID> psql --user <B2SHARE_POSTGRESQL_USER> <B2SHARE_POSTGRESQL_DBNAME> | ||
``` | ||
|
||
Now the database should be upgraded to version 13 | ||
|
||
**If there are issues** it is a good idea to reindex elasticsearch indices: | ||
|
||
Get B2SHARE container ID: | ||
|
||
```bash | ||
docker container ls --filter name=<COMPOSE_PROJECT_NAME>_b2share_1 --format {{.ID}} | ||
``` | ||
|
||
With container ID in hand, run: | ||
|
||
```bash | ||
docker exec -it <CONTAINER ID B2SHARE> bash | ||
# These commands executed in B2SHARE container | ||
b2share index destroy --force --yes-i-know | ||
b2share index init --force | ||
b2share index queue init purge | ||
|
||
b2share index reindex --yes-i-know | ||
b2share index run | ||
|
||
``` |