Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
75a6f8f
fix(pullElasticsearch): cleanup
patte Mar 23, 2018
0a2d3b5
chore(setup): add docker-compose.yml
patte Mar 30, 2018
9cde712
fix(setup): docker-compose.yml
patte Mar 30, 2018
f800a72
fix(pullElasticsearch): manual index with support for series
patte Mar 30, 2018
3f234b1
fix(pullElasticsearch): fix series episodes
patte Mar 30, 2018
2bebc2d
fix(pullElasticsearch): fix meta types, add content without indexing it
patte Mar 30, 2018
bc52cbf
fix(pullElasticsearch): disable dynamic mapping
patte Mar 30, 2018
bc7ada5
chore(docker): Ignore Docker Data and add Kibana to Docker Compose
Mar 30, 2018
f91a571
feat(elastic): Basic Search without Filtering
Mar 30, 2018
8f1b6e8
fix(pullElasticsearch): fix repoId, cleanup
patte Mar 30, 2018
8500b99
fix(pullElasticsearch): add german analyzer
patte Mar 30, 2018
4fa6d9e
feat(elastic): Add Pagination and Search Filters
Mar 30, 2018
39b1f1a
fix(elastic): typo
patte Mar 30, 2018
6bec6dd
refactor(elastic): lib in packages/base, honour ELASTIC_URL ENV
patte Apr 2, 2018
1f8659c
fix(documents): default page to 1 in documentsSearch
patte Apr 2, 2018
bb792f7
Merge branch 'master' into elastic
patte Apr 18, 2018
c41f05c
refactor(elastic): cleanup
patte Apr 18, 2018
d7fc62c
refactor(elastic): migrate from classes to functions
patte Apr 18, 2018
3cb8c0c
refactor(elastic): redux style pagination (first, after, before)
patte Apr 18, 2018
10f5e68
feat(elastic): add all filters the previous documents resolver suppor…
patte Apr 18, 2018
4317cd6
feat(elastic): honour DOCUMENTS_RESTRICT_TO_ROLES
patte Apr 18, 2018
fd85c66
feat(elastic): setup sorting, implement relevance and publishDate
patte Apr 18, 2018
d79af3d
feat(elastic): wip add document to index on publish
patte Apr 19, 2018
8225a2a
refactor(elastic): divide and conquer elastic setup scripts
patte Apr 20, 2018
1e9d9b4
refactor(elastic): wip: move documentsSearch from documents into its …
patte Apr 20, 2018
df1235b
fix(elastic): Rename mapping "document" to "documents"
patrickvenetz Apr 20, 2018
836f649
feat(elastic): Add "comments" mapping and inserts scripts
patrickvenetz Apr 20, 2018
68f2622
feat(elastic): Popuplate "comments" and "documents" indices
patrickvenetz Apr 20, 2018
3a69c85
refactor(elastic): wip: cleanup api
patte Apr 23, 2018
8688df3
refactor(elastic): cleanup schema, specify filters as array, cleanup …
patte Apr 25, 2018
7795b63
refactor(elastic): combine filters and aggregations in schema
patte Apr 26, 2018
ad9c32a
refactor(elastic): cleanup schema, filters and aggregations
patte Apr 26, 2018
c5e951f
refactor(elastic): move db/elastic/script to packages/search/script
patte May 1, 2018
c8d9c3c
refactor(elastic): cleanup index naming, stats for document insert
patte May 1, 2018
1c83f27
refactor(elastic): add type field to mappings and filters
patte May 2, 2018
3383539
refactor(elastic): type names
patte May 2, 2018
4ec2664
Merge branch 'master' into elastic
patte May 4, 2018
cf12eaa
feat(elastic): Add lib to index Postgres tables
patrickvenetz May 4, 2018
6c88319
refactor(elastic): Use indexPgTables lib to populate ES with "comments"
patrickvenetz May 4, 2018
7961455
fix(elastic): Address inserts[<type>] with a lower-cased key
patrickvenetz May 4, 2018
b325033
feat(elastic): Disable ES refresh interval while populating data
patrickvenetz May 4, 2018
226e6b9
feat(elastic): Add mapping and inserts for Users and Credentials
patrickvenetz May 4, 2018
19525ca
refactor(elastic): Rename packages/search/script to .../scripts
patrickvenetz May 4, 2018
d68afee
fix(elastic): Avoid potential variable shadowing
patrickvenetz May 5, 2018
431819e
Merge branch 'master' into elastic
patte May 8, 2018
2f02e4b
fix(elastic): rename scripts to script
patte May 8, 2018
1a5de6e
feat(elastic): migrate insert of documents to use repos from github d…
patte May 8, 2018
24a5a80
Merge branch 'master' into elastic
patte May 8, 2018
8982f0f
Merge branch 'master' into elastic
patte May 9, 2018
5edd50d
Merge branch 'master' into elastic
patte May 9, 2018
a4ddf27
fix(elastic): honour custom-type-field (__type) in pg inserts
patte May 9, 2018
509c783
fix(elastic): SearchEntity _resolveType resolver
patte May 9, 2018
ed07a01
fix(elastic): add User fields to search fields
patte May 9, 2018
52dd2fc
fix(elastic): transformUser for User hits
patte May 9, 2018
513eb75
feat(elastic): Enable lib/indexPgTable to delete multiple documents
patrickvenetz May 11, 2018
b84ca50
feat(elastic): Attach notify trigger to users, comments, credentials
patrickvenetz May 11, 2018
ee47857
Merge branch 'master' into elastic
patrickvenetz May 11, 2018
8249796
feat(elastic): Add initial version of republik/lib/pgNotifyDispatcher
patrickvenetz May 11, 2018
5fa5036
feat(elastic): Provide dict and list for script/inserts, script/mapping
patrickvenetz May 11, 2018
d10202c
fix(elastic): Use updated script/mapping, script/inserts files
patrickvenetz May 11, 2018
9aaa786
fix(elastic): Have notify dispatcher use mapping
patrickvenetz May 11, 2018
5804294
refactor(elastic): Rename pgNotifyDispatcher to notifyListener
patrickvenetz May 11, 2018
400238b
refactor(elastic): Use renamed notifyListener in "search" package
patrickvenetz May 11, 2018
efcebea
fix(elastic): Remove unwanted Document exclusion
patrickvenetz May 14, 2018
cb156f5
fix(elastic): Handle unmapped fields as "long" to prevent errors
patrickvenetz May 14, 2018
48c64af
fix(elastic): Typo, "unmapped_value" to "unmapped_type"
patrickvenetz May 14, 2018
41f46b6
fix(elastic): Allow SearchNode.score to be null
patrickvenetz May 14, 2018
0153421
refactor(elastic): Use a sort builder to build sort query
patrickvenetz May 14, 2018
24f2522
fix(documents): Replace "relative" URLs github/:org path w/ GITHUB_LOGIN
patrickvenetz May 15, 2018
fc16cb8
fix(assets): Configure, reduce concurrency of upload assets
patrickvenetz May 16, 2018
c420235
fix(elastic): Have boolParse recognize string values
patrickvenetz May 17, 2018
e627743
feat(search): Add SearchHighlight object type, returned in SearchNode
patrickvenetz May 17, 2018
8a72683
fix(search): Alter User mapping to improve searchability
patrickvenetz May 17, 2018
506c1d0
Merge remote-tracking branch 'origin' into elastic
patrickvenetz May 19, 2018
c7203bf
feat(search): Additional mapped fields
patrickvenetz May 19, 2018
66db6a7
feat(search): Add range filter
patrickvenetz May 19, 2018
d4c5634
fix(search): Straighten naming for text length filter, agg, criteria
patrickvenetz May 19, 2018
a398c8e
Merge remote-tracking branch 'origin' into elastic
patrickvenetz May 22, 2018
49b2a23
feat(search): Filter code blocks from mdast before stringifying
patrickvenetz May 22, 2018
7550c04
feat(search): Add exclusion feature to filters
patrickvenetz May 22, 2018
fbf0835
refactor(search): Move mapping files to lib/indices
patrickvenetz May 22, 2018
9da807d
refactor(search): Add mapping node to allow upcoming extensions
patrickvenetz May 22, 2018
db5c5b4
feat(search): Build query per document type
patrickvenetz May 22, 2018
be39b02
fix(search): Exclude credentials from indexing
patrickvenetz May 23, 2018
8f5c29b
feat(search): Label aggregations and, if possible, aggregation results
patrickvenetz May 23, 2018
60620ea
feat(search): Reintroduce boosted fields while querying ElasticSearch
patrickvenetz May 23, 2018
0463338
feat(search): Add User name as ES field to query to improve results
patrickvenetz May 23, 2018
a0da28f
feat(search): Index and query user name in comments
patrickvenetz May 23, 2018
330e12c
fix(search): Add sort by "createdAt"
patrickvenetz May 23, 2018
50187db
feat(search): Enables to configure highlights on a per index level
patrickvenetz May 23, 2018
eb6b4d4
feat(search): Add a generic date field (__sort.date) for sorting
patrickvenetz May 23, 2018
efeefa6
Merge remote-tracking branch 'origin' into elastic
patrickvenetz May 23, 2018
15c5ad8
Merge remote-tracking branch 'origin' into elastic
patrickvenetz May 24, 2018
2d672ac
Merge remote-tracking branch 'origin' into elastic
patrickvenetz May 24, 2018
62094ac
feat(search): De-ironify translations, remove "epic text length"
patrickvenetz May 24, 2018
7da018c
feat(search): Add utils to get alias and index name in a generic manner
patrickvenetz May 24, 2018
e48424b
feat(search): Use utils to generate alias and index name
patrickvenetz May 24, 2018
4ae7444
feat(search): Extend pullElasticsearch to allow zero-downtime indexing
patrickvenetz May 24, 2018
2280c6d
feat(search): Add optional search query and result tracking
patrickvenetz May 24, 2018
aa1e961
feat(search): Track also query run time
patrickvenetz May 24, 2018
538ca92
fix(search): Update translations
patrickvenetz May 24, 2018
95bb21d
feat(search): Rate duration also on an epic scale again
patrickvenetz May 24, 2018
03c34f8
ci: Disable in Docker Compose file many ElasticSearch xpack features
patrickvenetz May 24, 2018
4e2d5a8
Merge branch 'master' into elastic
patte May 25, 2018
94ab81b
ci: Remove xpack.reporting flag in Docker Compose file
patrickvenetz May 26, 2018
05e276f
fix(search): Alter boost balance and add __format field to query
patrickvenetz May 26, 2018
cfea0c3
feat(search): Call functions before and after inserts action
patrickvenetz May 26, 2018
6f913c0
feat(search): Remove Credential index
patrickvenetz May 27, 2018
eb8ec16
fix(docker): make elastic work from scratch (TAKE_FILE_OWNERSHIP)
patte May 27, 2018
fcabede
fix(search): remove unused credential insert
patte May 28, 2018
8f5a6fe
feat(search): WIP proper indexing of publications, index on publish
patte May 28, 2018
03c10b0
Merge branch 'master' into elastic
patte May 28, 2018
605f3b5
fix(search): move all meta preparations to prepareMetaForPublish (att…
patte May 28, 2018
d0d4cd9
ci: Add .nvmrc to declare node version to use
patrickvenetz May 29, 2018
0b01dd4
feat(republik): Run notify listener only if flag is set to true
patrickvenetz May 29, 2018
5585358
ci: Add example and comments to SEARCH_TRACK and NOTIFY_LISTENER flags
patrickvenetz May 29, 2018
edd3cb7
ci: Add ElasticSearch service to TravisCI test environment setup
patrickvenetz May 29, 2018
cf7ca55
ci: Remove node_js block and let TravisCI use /.nvmrc
patrickvenetz May 29, 2018
a2e868b
fix(search): filter indices (for aggs, filters) based on type filter
patte May 29, 2018
8311501
fix(search): add path to Documents schema
patte May 29, 2018
5fb3948
fix(search): support term array filter (terms)
patte May 29, 2018
8147662
fix(search): don't apply empty/undefined filters
patte May 29, 2018
2020cd9
Merge branch 'elastic' of github.com:orbiting/backends into elastic
patte May 29, 2018
6b7cb5f
feat(republik): Add preview prop to Comment nodes
patrickvenetz May 29, 2018
5255cab
feat(search): Filter editorialNewsletters which are not in feed
patrickvenetz May 29, 2018
240348a
refactor(republik): Put search flags and knobbles into own .env section
patrickvenetz May 29, 2018
f8f0206
feat(search): WIP migrate documents query to elastic
patte May 29, 2018
e0cadad
Merge branch 'elastic' of github.com:orbiting/backends into elastic
patte May 29, 2018
5cd46a9
fix(search): add pull:elasticsearch script to package.json
patte May 29, 2018
7e21fbc
feat(search): hasAudio, hasVideo for document schema
patte May 30, 2018
bb18883
chore(search): remove unused code
patte May 30, 2018
f3ec357
fix(search): load related documents in search not in documents
patte May 30, 2018
ef62566
fix(search): Use gitRepoId() to sanitized repoIds
patrickvenetz May 30, 2018
7f7eba0
docs: Add GITHUB_ORGS example in /.env.example
patrickvenetz May 30, 2018
b115d41
fix(search): add audioSource to Documents schema
patte May 30, 2018
13b41fb
Merge branch 'elastic' of github.com:orbiting/backends into elastic
patte May 30, 2018
425f90d
fix(republik): Update translations for search elements
patrickvenetz May 30, 2018
36adde2
fix(search): documents mapping add hasAudio, hasVideo; add missing fi…
patte May 30, 2018
278a3c7
Merge branch 'elastic' of github.com:orbiting/backends into elastic
patte May 30, 2018
58f4689
fix(search): filter logic and Documents aggregations
patte May 30, 2018
d693e2a
fix(search): Complete set of aggregations
patrickvenetz May 30, 2018
24efb6c
fix(republik): Update translations for search elements
patrickvenetz May 30, 2018
d6e1524
fix(search): Set first option when querying realted docs to ids length
patrickvenetz May 30, 2018
fed6d98
feat(search): Enable a preset filter on criteria and aggregations
patrickvenetz May 31, 2018
4bfb254
feat(search): Resolve user in Comment for ElasticSearch
patrickvenetz May 31, 2018
b764a25
fix(search): Anaylze credential with "german"
patrickvenetz May 31, 2018
40e9511
feat(search): Resolve credential (listed) in User for ElasticSearch
patrickvenetz May 31, 2018
1573cb2
feat(search): Resolve meta.format.meta in Document for ElasticSearch (2)
patrickvenetz May 31, 2018
9581f18
feat(search): Update notifyListener to update like pullElasticsearch
patrickvenetz Jun 2, 2018
503e0d2
fix(search): Fix wrong table, payload in default resource for user
patrickvenetz Jun 2, 2018
da3caa7
feat(search): Add draft for cascading update of ElasticSearch
patrickvenetz Jun 2, 2018
667f42d
feat(search): Fat-trimmed search tracking
patrickvenetz Jun 2, 2018
afb5765
feat(search): WIP publish: publish and publish-prepublication working
patte May 31, 2018
7f36c04
chore(search): cleanup
patte May 31, 2018
676b957
fix(search): WIP adapt publicationScheduler to elasticsearch WIP
patte Jun 1, 2018
3d2c9a2
fix(search): Accept date range string, or date range object { from, to }
patrickvenetz Jun 6, 2018
72febac
fix(search): Index meta.scheduledAt as date field in ElasticSearch
patrickvenetz Jun 6, 2018
d5d4771
fix(search): Use publishDate, scheduledAt to query for "available" docs
patrickvenetz Jun 7, 2018
13c1a1f
fix(search): Add multiple updates to lib/Documents
patrickvenetz Jun 7, 2018
bbe0fc0
fix(search): Avoid limit by scheduledAt when retrieving published docs
patrickvenetz Jun 7, 2018
ad10fcb
fix(search): Setup publish pipelines
patrickvenetz Jun 11, 2018
17cd491
fix(signin): remove location from email, handled in frontend authoriz…
tpreusse May 31, 2018
d867a39
fix(search): Await promise of transactionCommit, transactionRollback
patrickvenetz Jun 7, 2018
f9a552e
fix(search): Query state according to roles a user has
patrickvenetz Jun 11, 2018
60ba203
fix(search): Set first arugment to a 1000 to imitate previous behaviour
patrickvenetz Jun 11, 2018
0aa9a86
fix(search): Remove must_not meta.scheduledAt query
patrickvenetz Jun 11, 2018
d12c93e
feat(search): Have pullElasticsearch accept a series of arguments
patrickvenetz Jun 11, 2018
6347e82
ci: Setup ElasticSearch indices
patrickvenetz Jun 11, 2018
d5ff865
ci: Attempt to setup ElasticSearch while preparing for tests
patrickvenetz Jun 11, 2018
0b5b6e3
ci: Attempt to setup ElasticSearch while preparing for tests
patrickvenetz Jun 11, 2018
17e71ea
ci: Fix run script
patrickvenetz Jun 11, 2018
d056c86
fix(search): Fix undefined omit function
patrickvenetz Jun 12, 2018
0ea788a
fix(search): Improve search tracking with total result number
patrickvenetz Jun 12, 2018
cd3eb3d
fix(search): Fix wrong state when publishing
patrickvenetz Jun 13, 2018
18389f7
fix(search): Fix state, scheduled documents when populating ES
patrickvenetz Jun 13, 2018
3220210
fix(search): Remove publishDate filter
patrickvenetz Jun 13, 2018
35f0bd6
ci: Install ElasticSearch 6.2.3 on TravisCI
patrickvenetz Jun 13, 2018
6eb02d5
test(publikator): Avoid naming collisions in reposQuery and name asserts
patrickvenetz Jun 13, 2018
98ee83d
fix(publikator): Wait after publish
patrickvenetz Jun 13, 2018
e95a3f2
test(publikator): Name some asserts and avoid repo name collision
patrickvenetz Jun 13, 2018
91705b4
fix(search): Apply role-based filter if available in indices
patrickvenetz Jun 14, 2018
3345c96
fix(publikator): Add more debugging messages to publicationScheduler
patrickvenetz Jun 14, 2018
cfa2e62
fix(publikator): Publish refresh message into publication channel
patrickvenetz Jun 14, 2018
41adb9a
fix(search): Upgrade of publish pipeline
patrickvenetz Jun 14, 2018
cfc4406
fix(assets): Query blob with "file_sha" instead of "sha" (deprecated)
patrickvenetz Jun 14, 2018
e8e3b02
fix(republik): Run notifyListener only when SEARCH_PG_LISTENER is truthy
patrickvenetz Jun 14, 2018
7ee1247
fix(documents): Fix query with after, before arguments
patrickvenetz Jun 14, 2018
b41ccf4
fix(search): Use original filter option to build cursors
patrickvenetz Jun 14, 2018
9a4d02b
fix(search): Find already-in-use path ("slug")
patrickvenetz Jun 15, 2018
9323dbd
feat(search): Add function to find published documents
patrickvenetz Jun 15, 2018
fa08d01
fix(publikator): Refurnish redirect pipline on publish w/ ES query
patrickvenetz Jun 15, 2018
62d1e41
fix(publikator): Switch prepublication tag in scheduled jobs too
patrickvenetz Jun 15, 2018
cb24f51
fix(search): Fix findPublished query
patrickvenetz Jun 15, 2018
66e9e74
test(publikator): Test dups again and add assert some more descriptions
patrickvenetz Jun 15, 2018
909f051
fix(search): Refresh data after updateByQuery, and call resetScheduledAt
patrickvenetz Jun 16, 2018
e2f2561
fix(publikator): Refresh scheduler whenever a document is published
patrickvenetz Jun 16, 2018
ead23e7
fix(search): Resolve content zone data urls
patrickvenetz Jun 16, 2018
d030d84
fix(search): Pass original filter to restrict documents properly
patrickvenetz Jun 16, 2018
1066d44
fix(documents): Keep arguments "undefined" if not set
patrickvenetz Jun 16, 2018
9220251
fix(search): Improve docuemntIdParser and provide "findTemplates" query
patrickvenetz Jun 16, 2018
565c8d5
fix(search): Remove "getRepoIdFromDocumentId"
patrickvenetz Jun 16, 2018
c6c062b
fix(search): Use "findTemplate" function to popuplate doc.resolved.meta
patrickvenetz Jun 16, 2018
9702089
fix(publikator): Use "findTemplate" fn to populate doc.resolved.meta
patrickvenetz Jun 16, 2018
c373f08
fix(search): Provide getResourceUrls and add resolved prop to ElasticDoc
patrickvenetz Jun 17, 2018
a48a55e
fix(search): Resolve format, dossier in ElasticSearch to query + mapping
patrickvenetz Jun 17, 2018
7624edc
fix(publikator): Resolve format, dossier while publishing
patrickvenetz Jun 17, 2018
62d8f77
fix(publikator): Publish refresh message for scheduler when unpublishing
patrickvenetz Jun 17, 2018
904e891
fix(search): Cache MailChimp Campaign ID into Redis again
patrickvenetz Jun 17, 2018
454baa1
fix(publikator): Find up to 10,000 published documents
patrickvenetz Jun 17, 2018
5a91b93
fix(publikator): Debug and note about a potentially dead piece of code
patrickvenetz Jun 17, 2018
f865564
fix(search): Do not track queries retrieving related documents
patrickvenetz Jun 17, 2018
8acf2ca
fix(search): Use "debug" instead of "console.log"
patrickvenetz Jun 17, 2018
817a00b
fix(republik): Update translations
patrickvenetz Jun 17, 2018
37fbb79
fix(search): Retrieve scheduled publications when resolving repo IDs
patrickvenetz Jun 18, 2018
0a7ef8f
fix(publikator): Replace getPublishedDocuemtns w/ addRelatedDocs
patrickvenetz Jun 18, 2018
7213753
style(documents): Remove commented code
patrickvenetz Jun 18, 2018
9b61bfc
fix(search): Call rolebase filter as their functions
patrickvenetz Jun 18, 2018
da14a41
feat(search): Update search query to weight compound terms more
patrickvenetz Jun 18, 2018
f94b23b
refactor(publikator): Use destructered pattern when using createPublish
patrickvenetz Jun 18, 2018
d11f847
fix(search): Query scheduledAt only if argument is set
patrickvenetz Jun 19, 2018
8231323
fix(publikator): Sleep once more after publishing action
patrickvenetz Jun 19, 2018
2045baf
Merge remote-tracking branch 'origin/master' into elastic
patrickvenetz Jun 19, 2018
82ff72d
fix(documents): Return credits, audioSource again
patrickvenetz Jun 19, 2018
12c63d9
fix(search): remove unused code
patte Jun 19, 2018
8fead6e
fix(search): remove obsolete pullRedis
patte Jun 19, 2018
fbdff73
fix(search): Pass original filter to rolebased filter functions
patrickvenetz Jun 19, 2018
d66b705
fix(search): Index and query for versionName and query if needed
patrickvenetz Jun 19, 2018
f9a1f0d
fix(documents): Find document w/ versionName
patrickvenetz Jun 19, 2018
e270e30
fix(publikator): Retrieve document on a Publication from ElasticSearch
patrickvenetz Jun 19, 2018
c199a92
fix(publikator): Improve delete test repos script in minor ways
patrickvenetz Jun 19, 2018
cc2e5b8
fix(search): cleanup filter naming and handling in search query, fix …
patte Jun 19, 2018
b1f0b3d
fix(search): Enable query by id or an array of IDs, expose getDocumentId
patrickvenetz Jun 20, 2018
64640ca
fix(publikator): Query documents for publications early
patrickvenetz Jun 20, 2018
f7a6e50
refactor(publikator): Alter "map(a => fx(a))" to "map(fx))" + styles
patrickvenetz Jun 20, 2018
fc08c7b
feat(search): add format.meta.kind filter and agg
patte Jun 20, 2018
30ec917
Merge branch 'elastic' of github.com:orbiting/backends into elastic
patte Jun 20, 2018
b890b01
fix(publikator): Fallback fetch of Document in Publication resolver
patrickvenetz Jun 20, 2018
42c9d9f
fix(search): Set MAX_NODES to 10.000 records
patrickvenetz Jun 20, 2018
d9e36db
fix(publikator): Query documents only if field is requested in query
patrickvenetz Jun 20, 2018
c7e6596
fix(search): replace userId with anonymous sessionId for search tracking
patte Jun 20, 2018
38245b0
Merge branch 'elastic' of github.com:orbiting/backends into elastic
patte Jun 20, 2018
8a6eda6
fix(search): typo
patte Jun 20, 2018
ff16a0f
fix(search): naming
patte Jun 20, 2018
004a2ae
fix(search): never include trackingId in cursors
patte Jun 20, 2018
d30522f
fix(publikator): Bugfix condition when to return doc
patrickvenetz Jun 20, 2018
e3a86fb
refactor(publikator): Name resolved parent object (instead of "_")
patrickvenetz Jun 20, 2018
a16dd4a
feat(publikator): Disable publish, unpublish via ENV flags
patrickvenetz Jun 20, 2018
91fd9be
fix(publikator): Single ENV variable to disable publish operations
patrickvenetz Jun 20, 2018
2af2024
fix(publikator): Update .env.example
patrickvenetz Jun 20, 2018
e6cf953
Merge pull request #56 from orbiting/elastic-pub-disable-publish
patrickvenetz Jun 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ DATABASE_URL=postgres://localhost:5432/republik
# redis url, leave blank for default: 127.0.0.1:6379
#REDIS_URL=

# elasticsearch url, leave blank for default: localhost:9200
#ELASTIC_URL=

# url to republik-frontend
# used by
# - auth to construct token links
Expand Down Expand Up @@ -121,6 +124,9 @@ AWS_SECRET_ACCESS_KEY=
# log ratelimit every 15min to stdout
#GITHUB_LOG_RATELIMIT=true

# List of all potential GitHub organizations data my stem from (optional)
#GITHUB_ORGS=organization-one,organization-two

# checkout the README on how to get these
GITHUB_LOGIN=
GITHUB_APP_ID=
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ typings/
# Yarn Integrity file
.yarn-integrity

# Mapped Docker Volumes
docker-data/

# dotenv environment variables file
.env
.test.env
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: node_js
node_js:
- '10.2.1'
cache:
directories:
- node_modules
Expand All @@ -10,6 +8,7 @@ notifications:
addons:
postgresql: "9.6"
services:
- elasticsearch
- postgresql
- redis-server
branches:
Expand Down Expand Up @@ -47,5 +46,11 @@ env:
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.7.0
- export PATH=$HOME/.yarn/bin:$PATH
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.deb && sudo dpkg -i --force-confnew elasticsearch-6.2.3.deb && sudo service elasticsearch restart
before_script:
# ElasticSearch takes few seconds to start, to make sure it is available
# when the build script runs add a small delay to your build script
# see https://docs.travis-ci.com/user/database-setup/#ElasticSearch
- sleep 10
script:
- cd $TEST_DIR && yarn run test:travis
34 changes: 34 additions & 0 deletions docker-compose.republik-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.4"
services:
republik-backend:
build:
context: ./servers/republik
image: republik-backend:latest
links:
- redis
- postgres
environment:
- DATABASE_URL=postgres://postgres@postgres:5432/republik
- REDIS_URL=redis:6379
- PUBLIC_URL=http://localhost:8080
- PUBLIC_WS_URL_BASE=ws://localhost:8080
- FRONTEND_BASE_URL
- PUBLIC_WS_URL_PATH
- SESSION_SECRET
- CORS_WHITELIST_URL
- SEND_MAILS
- MANDRILL_API_KEY
- DEFAULT_MAIL_FROM_NAME
- DEFAULT_MAIL_FROM_ADDRESS
- AUTH_MAIL_FROM_ADDRESS
- DISPLAY_AUTHOR_SECRET
- EXO_KEY
- EXO_SECRET
- S3BUCKET
- ASSETS_BASE_URL
- KEYCDN_API_KEY
- KEYCDN_ZONE_ID
- KEYCDN_ZONE_URL
- PHANTOMJSCLOUD_API_KEY
ports:
- 8080:3020
74 changes: 35 additions & 39 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
version: "3.4"
services:
republik-backend:
build:
context: ./servers/republik
image: republik-backend:latest
links:
- redis
- postgres
elastic:
# in order to get elastic to work, see https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.3
container_name: elasticsearch
environment:
- DATABASE_URL=postgres://postgres@postgres:5432/republik
- REDIS_URL=redis:6379
- PUBLIC_URL=http://localhost:8080
- PUBLIC_WS_URL_BASE=ws://localhost:8080
- FRONTEND_BASE_URL
- PUBLIC_WS_URL_PATH
- SESSION_SECRET
- CORS_WHITELIST_URL
- SEND_MAILS
- MANDRILL_API_KEY
- DEFAULT_MAIL_FROM_NAME
- DEFAULT_MAIL_FROM_ADDRESS
- AUTH_MAIL_FROM_ADDRESS
- DISPLAY_AUTHOR_SECRET
- EXO_KEY
- EXO_SECRET
- S3BUCKET
- ASSETS_BASE_URL
- KEYCDN_API_KEY
- KEYCDN_ZONE_ID
- KEYCDN_ZONE_URL
- PHANTOMJSCLOUD_API_KEY
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- xpack.graph.enabled=false
- xpack.ml.enabled=false
- xpack.monitoring.enabled=false
- xpack.security.enabled=false
- xpack.watcher.enabled=false
- ELASTIC_PASSWORD=elastic
- "discovery.type=single-node"
- TAKE_FILE_OWNERSHIP=true
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./docker-data/elastic:/usr/share/elasticsearch/data
ports:
- 9200:9200

kibana:
image: docker.elastic.co/kibana/kibana:6.2.3
container_name: kibana
ports:
- 8080:3020
- 5601:5601
depends_on:
- elastic

redis:
image: redis:4-alpine
image: redis:alpine
ports:
- 6379:6379
- 6379:6379
volumes:
- ./docker-data/redis:/data

postgres:
image: postgres:10-alpine
image: postgres:10
volumes:
- postgres-data:/var/lib/postgresql
- ./docker-data/postgres:/var/lib/postgresql/data
ports:
- 5432:5432


volumes:
postgres-data:
- 5432:5432
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"commitmsg": "validate-commit-msg",
"roleUser": "node packages/auth/script/roleUser",
"roleUsers": "node packages/auth/script/roleUsers",
"pull:redis": "node servers/publikator/script/pullRedis.js"
"pull:redis": "node servers/publikator/script/pullRedis.js",
"pull:elasticsearch": "node packages/search/script/pullElasticsearch.js"
}
}
79 changes: 42 additions & 37 deletions packages/assets/lib/Repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const {
upload: uploadS3,
getHead
} = require('./s3')
const debug = require('debug')('assets')
const Promise = require('bluebird')
const debug = require('debug')('assets:lib:Repo')

const CONCURRENCY = 2

const {
ASSETS_SERVER_BASE_URL,
Expand All @@ -22,46 +25,48 @@ const uploadImages = async (repoId, paths) => {
const { githubRest } = await createGithubClients()
const [owner, repo] = repoId.split('/')

await Promise.all(
paths.map( async (path) => {
// the filename is the blobSha
const blobSha = path
.split('/')
.pop()
.split('.')[0]
await Promise.map(paths, async path => {
// the filename is the blobSha
const blobSha = path
.split('/')
.pop()
.split('.')[0]

const s3Path = getS3PathForGithubPath(repoId, path)

const s3Path = getS3PathForGithubPath(repoId, path)
if (!await getHead({ bucket: AWS_S3_BUCKET, path: s3Path })) {
let result
let error

if(!await getHead({
bucket: AWS_S3_BUCKET,
path: s3Path
})) {
let result
let error
try {
result = await githubRest.gitdata.getBlob({
owner,
repo,
sha: blobSha
})
} catch(e) {
error = e
result = null
}
if (error || !result || !result.data || !result.data.content) {
console.error('getBlob failed for ', {owner, repo, blobSha, path, error})
throw new Error('getBlob failed for: '+ s3Path)
}
return uploadS3({
stream: Buffer.from(result.data.content, 'base64'),
path: s3Path,
bucket: AWS_S3_BUCKET
try {
result = await githubRest.gitdata.getBlob({
owner,
repo,
file_sha: blobSha
})
} else {
debug('uploadImages exists %s', s3Path)
} catch (e) {
error = e
result = null
}
})
)

if (error || !result || !result.data || !result.data.content) {
console.error(
'getBlob failed for ',
{ owner, repo, blobSha, path, error }
)
throw new Error(`getBlob failed for: ${s3Path}`)
}

return uploadS3({
stream: Buffer.from(result.data.content, 'base64'),
path: s3Path,
bucket: AWS_S3_BUCKET
})
} else {
debug('uploadImages exists %s', s3Path)
}
},
{ concurrency: CONCURRENCY })
}

module.exports = {
Expand Down
1 change: 1 addition & 0 deletions packages/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"isomorphic-unfetch": "^2.0.0"
},
"dependencies": {
"bluebird": "^3.5.1",
"aws-sdk": "^2.246.1",
"check-env": "^1.3.0",
"debug": "^3.1.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/base/express/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const cookieParser = require('cookie-parser')
const checkEnv = require('check-env')
const { transformUser } = require('@orbiting/backend-modules-auth')
const redis = require('../lib/redis')
const elasticsearch = require('../lib/elastic')

checkEnv([
'PUBLIC_WS_URL_BASE',
Expand All @@ -33,7 +34,8 @@ module.exports = (
pgdb,
user,
pubsub,
redis
redis,
elastic: elasticsearch.client()
})

const subscriptionServer = SubscriptionServer.create(
Expand Down
11 changes: 11 additions & 0 deletions packages/base/lib/elastic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const elasticsearch = require('elasticsearch')

const {
ELASTIC_URL
} = process.env

module.exports.client = () => {
return new elasticsearch.Client({
host: ELASTIC_URL || 'localhost:9200'
})
}
1 change: 1 addition & 0 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"d3-time-format": "^2.1.1",
"elasticsearch": "^14.2.2",
"export-files": "^2.1.1",
"express": "^4.16.3",
"graphql-redis-subscriptions": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/documents/graphql/resolvers/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { lib: { webp: {

const shouldDeliverWebP = (argument = 'auto', req) => {
if (argument === 'auto') {
return req.get('Accept').indexOf('image/webp') > -1
return req && req.get('Accept').indexOf('image/webp') > -1
}
return !!argument
}
Expand Down
3 changes: 2 additions & 1 deletion packages/documents/graphql/resolvers/_queries/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ const getDocuments = require('./documents')

module.exports = async (_, args, context) => {
const {
id,
path,
repoId
} = args

return getDocuments(_, { path, repoId }, context)
return getDocuments(_, { id, path, repoId }, context)
.then(docCon => docCon.nodes[0])
}
Loading