Skip to content

Commit 9bdd54b

Browse files
authored
Fix delete timeline stored in Opensearch (#46)
IR-723
1 parent f8205ee commit 9bdd54b

File tree

9 files changed

+24
-82
lines changed

9 files changed

+24
-82
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,6 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened]
88
jobs:
9-
# OpenSearch version 1.x.x
10-
PyPi-plaso-stable-opensearch-v1:
11-
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
os: [ubuntu-22.04]
15-
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up infrastructure with docker compose
18-
run: docker compose -f docker/e2e/docker-compose.yml up -d
19-
env:
20-
OPENSEARCH_VERSION: 1.3.10
21-
PLASO_PPA_TRACK: stable
22-
- name: Run e2e tests
23-
run: docker compose -f docker/e2e/docker-compose.yml exec -T timesketch python3 /usr/local/src/timesketch/end_to_end_tests/tools/run_in_container.py
24-
- name: Dump docker logs on failure
25-
if: failure()
26-
uses: jwalton/gh-docker-logs@v2
27-
PyPi-plaso-staging-opensearch-v1:
28-
runs-on: ubuntu-latest
29-
strategy:
30-
matrix:
31-
os: [ubuntu-22.04]
32-
steps:
33-
- uses: actions/checkout@v2
34-
- name: Set up infrastructure with docker compose
35-
run: docker compose -f docker/e2e/docker-compose.yml up -d
36-
env:
37-
OPENSEARCH_VERSION: 1.3.10
38-
PLASO_PPA_TRACK: staging
39-
- name: Run e2e tests
40-
run: docker compose -f docker/e2e/docker-compose.yml exec -T timesketch python3 /usr/local/src/timesketch/end_to_end_tests/tools/run_in_container.py
41-
- name: Dump docker logs on failure
42-
if: failure()
43-
uses: jwalton/gh-docker-logs@v2
44-
45-
# OpenSearch version 2.x.x
469
PyPi-plaso-stable-opensearch-v2:
4710
runs-on: ubuntu-latest
4811
strategy:
@@ -60,21 +23,3 @@ jobs:
6023
- name: Dump docker logs on failure
6124
if: failure()
6225
uses: jwalton/gh-docker-logs@v2
63-
PyPi-plaso-staging-opensearch-v2:
64-
runs-on: ubuntu-latest
65-
strategy:
66-
matrix:
67-
os: [ubuntu-22.04]
68-
steps:
69-
- uses: actions/checkout@v2
70-
- name: Set up infrastructure with docker compose
71-
run: docker compose -f docker/e2e/docker-compose.yml up -d
72-
env:
73-
OPENSEARCH_VERSION: 2.9.0
74-
PLASO_PPA_TRACK: staging
75-
- name: Run e2e tests
76-
run: docker compose -f docker/e2e/docker-compose.yml exec -T timesketch python3 /usr/local/src/timesketch/end_to_end_tests/tools/run_in_container.py
77-
- name: Dump docker logs on failure
78-
if: failure()
79-
uses: jwalton/gh-docker-logs@v2
80-

contrib/tsdev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ else
4343
fi
4444

4545
# Set variables required to execute commands
46-
CONTAINER_ID="$($s docker container list --filter name='timesketch-dev' --quiet)"
46+
CONTAINER_ID="$($s docker container list --filter name='timesketch' --quiet)"
4747
frontend="frontend-ng"
4848

4949
# Run the provided command

docker/dev/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,29 @@ If you see the following message you can continue
1818
```
1919
Timesketch development server is ready!
2020
```
21+
2122
### Find out container ID for the timesketch container
2223

2324
```
24-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
25+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
2526
```
27+
2628
In the output look for CONTAINER ID for the timesketch container
2729

2830
To write the ID to a variable, use:
31+
2932
```
30-
export CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
33+
export CONTAINER_ID="$(docker container list -f name=timesketch -q)"
3134
```
35+
3236
and test with
37+
3338
```
3439
echo $CONTAINER_ID
3540
```
3641

3742
### Start a celery container shell
43+
3844
```
3945
docker exec -it $CONTAINER_ID celery -A timesketch.lib.tasks worker --loglevel info
4046
```
@@ -45,17 +51,18 @@ docker exec -it $CONTAINER_ID celery -A timesketch.lib.tasks worker --loglevel i
4551
docker exec -it $CONTAINER_ID gunicorn --reload -b 0.0.0.0:5000 --log-file - --timeout 600 -c /usr/local/src/timesketch/data/gunicorn_config.py timesketch.wsgi:application
4652
```
4753

48-
You now can access your development version at http://127.0.0.1:5000/
54+
You now can access your development version at <http://127.0.0.1:5000/>
4955

5056
Log in with user: dev password: dev
5157

52-
You can also access a metrics dashboard at http://127.0.0.1:3000/
58+
You can also access a metrics dashboard at <http://127.0.0.1:3000/>
5359

5460
### Non-interactive
5561

5662
Running the following as a script after `docker compose up -d` will bring up the development environment in the background for you.
63+
5764
```
58-
export CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
65+
export CONTAINER_ID="$(docker container list -f name=timesketch -q)"
5966
docker exec $CONTAINER_ID celery -A timesketch.lib.tasks worker --loglevel info
6067
docker exec $CONTAINER_ID gunicorn --reload -b 0.0.0.0:5000 --log-file - --timeout 120 timesketch.wsgi:application
6168
```
@@ -71,7 +78,7 @@ That will run all tests in your docker container. It is recommended to run all t
7178
### Jupyter Notebook
7279

7380
To access a Jupyter notebook that has access to the Timesketch development
74-
environment start a browser and visit http://localhost:8844/ . The password to
81+
environment start a browser and visit <http://localhost:8844/> . The password to
7582
gain access is "timesketch".
7683

7784
By default the /tmp directory is mapped as the data directory to store all
@@ -110,5 +117,5 @@ active.
110117
To update the docker image run:
111118

112119
```shell
113-
$ sudo docker image pull us-docker.pkg.dev/osdfir-registry/timesketch/notebook:latest
120+
sudo docker image pull us-docker.pkg.dev/osdfir-registry/timesketch/notebook:latest
114121
```

docker/dev/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
version: "3"
22
services:
33
timesketch:
4-
container_name: timesketch-dev
4+
container_name: timesketch
55
image: us-docker.pkg.dev/osdfir-registry/timesketch/dev:latest
66
command: timesketch
77
ports:
88
- 127.0.0.1:5000:5000
99
- 127.0.0.1:5001:5001
10-
- 127.0.0.1:8080:8080
1110
links:
1211
- opensearch
1312
- postgres

docker/dev/restart.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
2-
export CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
2+
export CONTAINER_ID="$(docker container list -f name=timesketch -q)"
33
docker exec -d $CONTAINER_ID celery -A timesketch.lib.tasks worker --loglevel info
44
docker exec -d $CONTAINER_ID gunicorn --reload -b 0.0.0.0:5000 --log-file - --timeout 600 -c /usr/local/src/timesketch/data/gunicorn_config.py timesketch.wsgi:application

docker/dev/start_frontend.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ echo "[i] Script (NOT TESTED) to run the frontend in dev mode"
44
echo "[i] Run this script in timesketch/docker/dev"
55
echo "[i] Remember to run 'docker compose up -d' to start the containers"
66

7-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
7+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
88
docker exec -d $CONTAINER_ID celery -A timesketch.lib.tasks worker --loglevel info
99
docker compose exec timesketch yarn install --cwd=/usr/local/src/timesketch/timesketch/frontend
1010
docker compose exec -d timesketch yarn run --cwd=/usr/local/src/timesketch/timesketch/frontend build --mode development --watch

docs/developers/frontend-development.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ You need two shells:
4949
1. Start the main webserver (for serving the API etc) in the first shell:
5050

5151
```bash
52-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
52+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
5353
docker exec -it $CONTAINER_ID gunicorn --reload -b 0.0.0.0:5000 --log-file - --timeout 600 -c /usr/local/src/timesketch/data/gunicorn_config.py timesketch.wsgi:application
5454
```
5555

5656
2. Start the development webserver in the second shell:
5757

5858
```bash
59-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
59+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
6060
docker compose exec timesketch yarn run --cwd=/usr/local/src/timesketch/timesketch/frontend serve
6161
```
6262

@@ -102,14 +102,14 @@ You need two shells:
102102
1. Start the main webserver (for serving the API etc) in the first shell:
103103

104104
```bash
105-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
105+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
106106
docker exec -it $CONTAINER_ID gunicorn --reload -b 0.0.0.0:5000 --log-file - --timeout 600 -c /usr/local/src/timesketch/data/gunicorn_config.py timesketch.wsgi:application
107107
```
108108

109109
2. Start the development webserver in the second shell:
110110

111111
```bash
112-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
112+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
113113
docker compose exec timesketch yarn run --cwd=/usr/local/src/timesketch/timesketch/frontend-ng serve
114114
```
115115

@@ -124,7 +124,7 @@ If you already have a yarn process running with the "old" frontend, it might not
124124
Generate UI builds:
125125

126126
```bash
127-
CONTAINER_ID="$(docker container list -f name=timesketch-dev -q)"
127+
CONTAINER_ID="$(docker container list -f name=timesketch -q)"
128128
docker exec -it $CONTAINER_ID timesketch bash
129129
cd /usr/local/src/timesketch/timesketch/frontend-ng
130130
yarn build

docs/guides/admin/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ If you started the webserver with docker, look in the console where you started:
115115
docker exec -it $CONTAINER_ID gunicorn --reload -b 0.0.0.0:5000 --log-file --timeout 600 timesketch.wsgi:application
116116
```
117117

118-
Or run the following where `$CONTAINER_ID` is the ID from your `timesketch-dev` or `timesketch` Docker container.
118+
Or run the following where `$CONTAINER_ID` is the ID from your `timesketch` Docker container.
119119

120120
```shell
121121
docker logs $CONTAINER_ID

timesketch/api/v1/resources/timeline.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,6 @@ def delete(self, sketch_id, timeline_id):
408408
close_index = False
409409
break
410410

411-
if close_index:
412-
try:
413-
self.datastore.client.indices.close(index=searchindex.index_name)
414-
except opensearchpy.NotFoundError:
415-
logger.error(
416-
"Unable to close index: {0:s} - index not "
417-
"found".format(searchindex.index_name)
418-
)
419-
420411
searchindex.set_status(status="archived")
421412
timeline.set_status(status="archived")
422413

0 commit comments

Comments
 (0)