Hi Nico, actually, yes. Here are my notes for everyone interested, how to set it up in AWS environment, using AWS OpenSearch:
- Use Amazon OpenSearch service: https://eu-north-1.console.aws.amazon.com/aos/
- Create a domain
- Eligible for free tier:
t3.small.search
- Make sure to create in the same VPC as EC2
- Under security configuration:
- Enable fine-grain control and create an admin username and password (to be used in the connection string, find below as [os_username]:[os_password])
- Create a VPC endpoint:
- Same VPC as EC2
- Same Subnet as EC2
- The opensearch security group:
- Allow inbound on 22 and 443 from the EC2’s security group
- Apply this security group to the VPC and the OpenSearch domain
Shopware configuration (add to .env.local):
OPENSEARCH_URL=https://[os_username]:[os_password]@[vpc-....es.amazonaws.com]:443
SHOPWARE_ES_ENABLED=1
SHOPWARE_ES_INDEXING_ENABLED=1
SHOPWARE_ES_INDEX_PREFIX=sw6
SHOPWARE_ES_THROW_EXCEPTION=1 # this prevents querying the DB as fallback
ADMIN_OPENSEARCH_URL=https://[os_username]:[os_password]@[vpc-....es.amazonaws.com]:443
SHOPWARE_ADMIN_ES_ENABLED=1
SHOPWARE_ADMIN_ES_REFRESH_INDICES=1
SHOPWARE_ADMIN_ES_INDEX_PREFIX=sw6_admin
SHOPWARE_ES_MULTILINGUAL_INDEX=1
Running initial indexing (in Shopware root folder):
bin/console es:admin:index
bin/console es:index
bin/console es:create:alias
Setting up a tunnel to the dashboard
Set up a tunnel in SSH connection as:
ssh -i .\.ssh\[server-private-key].pem ubuntu@[IP] -N -L 9100:[vpc-....es.amazonaws.com]:443
Access the dashboard from the local machine through: https://localhost:9100/_dashboards/
Important part: Database
Two tables were missing in the latest install: admin_elasticsearch_index_task
and elasticsearch_index_task
were not created with my latest installation, based on Shopware 6.5.8.7. However, I found those tables in a database instance from an earlier version and copied those over.
--
-- Set character set the client will use to send SQL statements to the server
--
SET NAMES 'utf8';
--
-- Create table `elasticsearch_index_task`
--
CREATE TABLE elasticsearch_index_task (
id binary(16) NOT NULL,
`index` varchar(500) NOT NULL,
alias varchar(500) NOT NULL,
entity varchar(500) NOT NULL,
doc_count int NOT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_unicode_ci,
ROW_FORMAT = DYNAMIC;
--
-- Create table `admin_elasticsearch_index_task`
--
CREATE TABLE admin_elasticsearch_index_task (
id binary(16) NOT NULL,
`index` varchar(500) NOT NULL,
alias varchar(500) NOT NULL,
entity varchar(500) NOT NULL,
doc_count int NOT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AVG_ROW_LENGTH = 1024,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_unicode_ci,
ROW_FORMAT = DYNAMIC;