-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds: initial service architecture for Elastic search service port #1802
adds: initial service architecture for Elastic search service port #1802
Conversation
4e2e85c
to
c3b74da
Compare
bd46a68
to
3eb9587
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial feedback, and let's get CI to work (prettier fixes, eslint fixes).
Also, this needs tests
|
||
const query = require('./src/routes/query'); | ||
|
||
const service = new Satellite(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also do:
const service = new Satellite({ router: query });
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this, and it didn't seem to find the /query
route with the above implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 1.5.1 or 1.5.2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've shipped 1.6.0, fyi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had tested with 1.5.2, latest at the time.
Will update to 1.6.0
3eb9587
to
bc2b7c8
Compare
3e5c882
to
11c9ca9
Compare
I notice you pushed a bunch of commits, but also that it's quite a bit out of date. Let me know when you want me to review this again. |
11c9ca9
to
2cc7341
Compare
Will do @humphd, right now just getting the env setup to write tests. Currently running into this issue:
|
What's running on 80 for you? |
Welp. Looks like I really need to clean this system given I'm fairly confident this is a Apache/PHP setup still running. |
Yup it was, back to writing tests now. |
Cool. I know you are well versed on docker and such, but if any of this needs explaining, let me know. I had to iterate and change a lot of it to make it all work. |
One question which I cannot seem to figure out, according to the README and
|
@raygervais we found out today that Docker on Windows can't do this custom domain name resolution via its DNS, so we switched to use I'm fixing it in #1944, which you can review if you want. |
…backend fixes: missing variables from port adds: documentation updates and code cleanup adds: corrections based on feedback and improvements adds: port of original tests (failing WIP) fixes: rebase issues and updates docker env
1a83b14
to
a222715
Compare
@@ -157,3 +185,22 @@ services: | |||
hard: -1 | |||
ports: | |||
- '9200' | |||
labels: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: @manekenpix recently changed this to expose 9200 in development, since we can't do fancy domain names for localhost. Check what's on master
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@humphd @manekenpix I don't see the Labels part on master - should it be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the way things are on master
yes. NOTE: we define things in different places now: the docker-compose.yml is our base file, and development.yml are overrides/extras for development/CI; production.yml for production. So look in all three places.
environment: | ||
- ELASTIC_APM_SERVICE_NAME=search | ||
- SEARCH_PORT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@humphd Can you please clarify what should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# Specify the redis port | ||
- 'traefik.http.services.elasticsearch.loadbalancer.server.port=9200' | ||
|
||
apm: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs in production.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to This ToDo, I will move the APM part to production.yml.
@humphd @manekenpix Also, why don't we have all of this on master, but just referenced in a ToDo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't done the Elastic/ELK stuff yet for logging, etc. We started to, but will follow-up with it later.
|
||
COPY --chown=node:node . . | ||
|
||
RUN npm install ci --only=production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUN npm install --only=production --no-package-lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
"version": "1.0.0", | ||
"description": "A service for optimizing images", | ||
"scripts": { | ||
"dev": "nodemon server.js | pino-pretty -c -t", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pino pretty
isn't needed now, we do it for you in Satellite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
"scripts": { | ||
"dev": "nodemon server.js | pino-pretty -c -t", | ||
"start": "node server.js", | ||
"test": "jest test.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test config and execution all happens from the root now. Setup your tests like we do in image, feed-discovery, posts, etc. https://github.com/Seneca-CDOT/telescope/blob/master/src/api/image/jest.config.js
"node": ">=12.0.0" | ||
}, | ||
"devDependencies": { | ||
"del-cli": "^3.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove everything in here except supertest and nodemon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const { text, filter, page, perPage } = req.query; | ||
res.send(await search(text, filter, page, perPage)); | ||
} catch (error) { | ||
res.status(500).send(`There was an error while executing your query: ${error}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of using APM, you might want to call next(err)
instead, and let it go down through to the error handler, where we'll log and deal with it in APM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,118 @@ | |||
const request = require('supertest'); | |||
process.env.ELASTICSEARCH_HOSTS = 'http://elasticsearch:9200'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your tests can read in config/env.development
(see how auth's jest tests do it).
@raygervais Do you need help on this one? Do you want me to participate? |
If you @izhuravlev or @HyperTHD want to take this over, it would be greatly appreciated. I'm bogged down with work and other items right now. |
@raygervais I'll take that. @HyperTHD your help and advice will be greatly appreciated! |
@izhuravlev What's the status on this? |
@humphd added some changes and added a couple of questions above for the parts that are unclear. |
Moving this work to #2106, thanks for getting it started. |
Issue This PR Addresses
Closes #1737
Type of Change
Description
Adds support for
search.docker.localhost
, which ports the original ELK query controller to a dedicated service. The following is added as a warning to not work further on the original codebase for querying:Checklist