This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createMultiCache = async (cachePromises) => { | |
| return Promise.all(cachePromises).then(caches => multiCaching(caches)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { caching } from 'cache-manager'; | |
| import { redisStore } from 'cache-manager-redis-yet'; | |
| async function createRedisCache(redisHost, ttl) { | |
| const redisConfig = { url: `redis://${redisHost}`, db: 0, ttl }; | |
| const redisCacheStore = await redisStore(redisConfig); | |
| return caching(redisCacheStore); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { caching, multiCaching } from 'cache-manager'; | |
| import { redisStore } from 'cache-manager-redis-yet'; | |
| function createMemoryCache(max, ttl) { | |
| return caching('memory', { max, ttl }); | |
| } | |
| async function createRedisCache(redisHost, ttl) { | |
| const redisConfig = { url: `redis://${redisHost}`, db: 0, ttl }; | |
| const redisCacheStore = await redisStore(redisConfig); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NoCacheableError, redisStore } from 'cache-manager-redis-yet'; | |
| const cachePromise = createCache(); // this method is creating the actual cache promise object (see other code snippets) | |
| const CacheWrapper = { | |
| get: async (key) => { | |
| if (cachePromise) { | |
| const cache = await cachePromise; | |
| return cache.get(key); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.7" | |
| # this file is taken from https://github.com/opf/openproject-deploy/blob/stable/11/compose/docker-compose.yml, replaced | |
| # the apache proxy with jwilder/nginx-proxy and the companion enabling ssl support | |
| networks: | |
| frontend: | |
| backend: | |
| volumes: | |
| pgdata: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install Docker | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge" | |
| apt-get install -y docker-ce | |
| sudo usermod -aG docker ubuntu | |
| # Install Docker Compose | |
| curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| chmod +x /usr/local/bin/docker-compose | |
| ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package de.wellnerbou.solr; | |
| import de.wellnerbou.solr.CollectionAwareEntityInformationFacade; | |
| import org.apache.solr.client.solrj.SolrClient; | |
| import org.apache.solr.client.solrj.impl.HttpSolrClient; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.data.solr.core.SolrTemplate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package de.wellnerbou.solr; | |
| import org.springframework.data.domain.Page; | |
| import org.springframework.data.domain.Pageable; | |
| import org.springframework.data.solr.core.SolrOperations; | |
| import org.springframework.data.solr.core.query.SimpleQuery; | |
| import org.springframework.data.solr.repository.query.SolrEntityInformation; | |
| import org.springframework.data.solr.repository.support.SimpleSolrRepository; | |
| public class YourRepository extends SimpleSolrRepository<YourSolrDocument, String> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package de.wellnerbou.solr; | |
| import org.springframework.data.solr.core.mapping.SimpleSolrMappingContext; | |
| import org.springframework.data.solr.repository.query.SolrEntityInformation; | |
| import org.springframework.data.solr.repository.support.SolrEntityInformationCreatorImpl; | |
| public class CollectionAwareEntityInformationFacade<T, ID> implements SolrEntityInformation<T, ID> { | |
| private SolrEntityInformation<T, ID> solrEntityInformation; | |
| private String collectionName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * First example from https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations | |
| */ | |
| Parameters params = new Parameters(); | |
| // Read data from this file | |
| File propertiesFile = new File("config.properties"); | |
| ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> builder = | |
| new ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class) |
NewerOlder