@@ -51,39 +51,13 @@ and run the consumer service on our local machine. This setup includes:
5151   docker compose up -d
5252   ``` 
5353
54- ### Consumer  
55- 
56- Spinning up a consumer service (intended to be a continually-running process; in
57- a production scenarion, multiple instances could be running simultaneously as
58- needed):
59- 
60-    ``` bash 
61-    docker compose run --env AWS_PROFILE=some-profile-name --env \
62-    Q_URL=" http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/sqs-senzing-local-ingest" 
63-    consumer
64-    ``` 
65- 
66- ### Exporter  
67- 
68- Spinning up the exporter middleware (this is intended to be an ephemeral
69- container):
70- 
71-   ``` bash 
72-   docker compose run --env AWS_PROFILE=localstack --env S3_BUCKET_NAME=sqs-senzing-local-export exporter
73-   ``` 
74- 
75- You can view information about files in the Localstack S3 bucket by visiting
76- this URL:
77- 
78-   http://localhost:4566/sqs-senzing-local-export 
54+ ### Using the services (tools container)  
7955
80- ###  Using  the services (Tools  container) 
56+ Access  the ` tools `   container to interact with the services: 
8157
82- 1 .  Access the ` tools `  container to interact with the services:
83- 
84-    ``` bash 
85-    docker compose run tools /bin/bash
86-   ``` 
58+     ```bash 
59+     docker compose run tools /bin/bash 
60+     ``` 
8761
8862The ` tools `  container should be configured with the necessary environment
8963variables to interact with the SQS and S3 services in LocalStack, as well as the
@@ -116,6 +90,120 @@ sz_command -C add_record \
11690  PEOPLE 1 ' {"NAME_FULL":"Robert Smith", "DATE_OF_BIRTH":"7/4/1976", "PHONE_NUMBER":"555-555-2088"}' 
11791``` 
11892
93+ #### Loading sample data  
94+ 
95+ From inside the tools container:
96+ 
97+ 1 .  Download the sample data sets; see:
98+ https://senzing.com/docs/quickstart/quickstart_docker/#download-the-files 
99+ 2 .  Register the data source names using ` sz_configtool ` ; see:
100+ https://senzing.com/docs/quickstart/quickstart_docker/#add-the-data-source 
101+ 3 .  Actually load each of the data files into the Senzing database, i.e.:
102+ 
103+         sz_file_loader -f customers.jsonl 
104+         sz_file_loader -f reference.jsonl 
105+         sz_file_loader -f watchlist.jsonl 
106+ 
107+ #### Additional utilities  
108+ 
109+ ##### Senzing and the database  
110+ 
111+ Load a single record as a simple test:
112+ 
113+     docker compose run tools python dev/add_1_record.py 
114+ 
115+ Purge the database:
116+ 
117+     docker compose run tools python dev/db_purge.py 
118+ 
119+ ##### S3  
120+ 
121+ You might need to configure an AWS profile before using these S3-related 
122+ utilities. See further down below for how to do that.
123+ 
124+ Copy a file out of the LocalStack S3 bucket into ` ~/tmp `  on your machine (be 
125+ sure this folder already exists -- on macOS, that would be 
126+ ` /Users/yourusername/tmp ` ):
127+ 
128+ >  [ !NOTE] 
129+ >  You will need to manually create ` /Users/yourusername/tmp `  if it
130+ >  doesn't already exist.
131+ 
132+     # Here, `hemingway.txt` is the file you wish to retrieve from S3. 
133+     docker compose run tools python3 dev/s3_get.py hemingway.txt       
134+ 
135+ Purge the LocalStack S3 bucket:
136+ 
137+     docker compose run tools python3 dev/s3_purge.py 
138+ 
139+ ## Middleware  
140+ 
141+ There are three middleware applications:
142+ 
143+ -  consumer (continually-running service)
144+ -  redoer (continually-running service)
145+ -  exporter (ephemeral container)
146+ 
147+ ### Configuring an AWS profile for LocalStack  
148+ 
149+ To use the middleware (consumer, etc.) with LocalStack, an AWS profile specific
150+ to LocalStack will be needed.
151+ 
152+ Your ` ~/.aws/config `  file should have something like:
153+ 
154+     [profile localstack] 
155+     region = us-east-1 
156+     output = json 
157+     ignore_configure_endpoint_urls = true 
158+     endpoint_url = http://localhost:4566 
159+ 
160+ Your ` ~/.aws/credentials `  file should have:
161+ 
162+     [localstack] 
163+     aws_access_key_id=test 
164+     aws_secret_access_key=test 
165+ 
166+ Generally speaking, the ` endpoint_url `  argument will be needed when
167+ instantiating client objects for use with particular LocalStack services, e.g.:
168+ 
169+     sess = boto3.Session() 
170+     if 'AWS_ENDPOINT_URL' in os.environ: 
171+         return sess.client('s3', endpoint_url=os.environ['AWS_ENDPOINT_URL']) 
172+     else: 
173+         return sess.client('s3') 
174+ 
175+ ### Consumer  
176+ 
177+ Spinning up the consumer middleware (intended to be a continually-running 
178+ process; in a production scenario, multiple instances could be running 
179+ simultaneously as needed):
180+ 
181+    ``` bash 
182+    docker compose run --env AWS_PROFILE=localstack --env \
183+    Q_URL=" http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/sqs-senzing-local-ingest" 
184+    --env LOG_LEVEL=INFO consumer
185+    ``` 
186+ 
187+ ` LOG_LEVEL `  is optional; defaults to ` INFO ` .
188+ 
189+ ### Exporter  
190+ 
191+ Spinning up the exporter middleware (this is intended to be an ephemeral
192+ container):
193+ 
194+   ``` bash 
195+   docker compose run --env AWS_PROFILE=localstack --env S3_BUCKET_NAME=sqs-senzing-local-export \
196+   --env LOG_LEVEL=INFO exporter
197+   ``` 
198+ 
199+ ` LOG_LEVEL `  is optional; defaults to ` INFO ` .
200+ 
201+ You can view information about files in the LocalStack S3 bucket by visiting
202+ this URL:
203+ 
204+   http://localhost:4566/sqs-senzing-local-export 
205+ 
206+ 
119207[ awslocal ] : https://docs.localstack.cloud/aws/integrations/aws-native-tools/aws-cli/#localstack-aws-cli-awslocal 
120208[ localstack ] : https://www.localstack.cloud/ 
121209[ senzing ] : https://senzing.com 
0 commit comments