Skip to content

Commit

Permalink
- add the docker folder to deploy in production
Browse files Browse the repository at this point in the history
- fix a lazy not initialized publication field in the listing of authors
  • Loading branch information
acheype committed Dec 14, 2017
1 parent 5d4e278 commit 69d534f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
11 changes: 6 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ module.exports = function (grunt) {
src: [
'<%= yeoman.dist %>/scripts/**/*.js',
'<%= yeoman.dist %>/assets/styles/**/*.css',
'<%= yeoman.dist %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}'//,
//'<%= yeoman.dist %>/assets/fonts/*'
'<%= yeoman.dist %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/assets/fonts/*'
]
}
}
Expand All @@ -166,7 +166,8 @@ module.exports = function (grunt) {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin', useminAutoprefixer] // Let cssmin concat files so it corrects relative paths to fonts and images
css: ['cssmin']//, useminAutoprefixer] // Let cssmin concat files so it corrects
// relative paths to fonts and images
},
post: {}
}
Expand Down Expand Up @@ -268,8 +269,8 @@ module.exports = function (grunt) {
src: [
'*.html',
'scripts/**/*.html',
'assets/images/**/*.{png,gif,webp,jpg,jpeg,svg}'
//'assets/fonts/*'
'assets/images/**/*.{png,gif,webp,jpg,jpeg,svg}',
'assets/fonts/*'
]
}, {
expand: true,
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
cd docker/test
docker-compose build

mkdir /data
mkdir /data/postgres -R
mkdir /data/es-data
sudo chown 999:999 es-data/
sudo chown 999:999 /data/es-data/


12 changes: 5 additions & 7 deletions docker/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
- MAIL_HOST= smtp.ird.nc
- MAIL_PORT= 25
env_file: ./malariaplantdb-web.env
# please define the variables POSTGRES_USER, POSTGRES_PASSWORD, MAIL_USERNAME and MAIL_PASSWORD in the
# malariaplantdb-web.env file.
# example of the environment file content :
# POSTGRES_USER=malariaplantdb
# POSTGRES_PASSWORD=mpdb
Expand All @@ -28,9 +30,6 @@ services:
- /data/postgresql:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- POSTGRES_USER=malariaplantdb
- POSTGRES_PASSWORD=mpdb
env_file: ./malariaplantdb-db.env
# please define the variables POSTGRES_USER and POSTGRES_PASSWORD in the malariaplantdb-db.env file.
# example of the environment file content :
Expand All @@ -39,12 +38,11 @@ services:

elasticsearch:
container_name: malariaplantdb-es
image: elasticsearch:5.6.5
image: itzg/elasticsearch:1.3
volumes:
- /data/es-data:/usr/share/elasticsearch/data
- /data/es-data:/data
ports:
- "9200:9200"
- "9300:9300"
environment:
- cluster.name=malariaplantdb-cluster
- ES_JAVA_OPTS=-Xms1g -Xmx1g
- CLUSTER=malariaplantdb-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface InVitroPharmacoRepository extends JpaRepository<InVitroPharmaco

List<InVitroPharmaco> findByPublicationId(Long id);

// Other method to fetch the authors and compilers relationships, but as it's by a join, the firsResult and
// Other method to fetch the authors and compilers relationships, but as it's by a join, the firstResult and
// maxResults are applied in memory
//@Query("select distinct inVitroPharmaco from InVitroPharmaco inVitroPharmaco left join fetch inVitroPharmaco" +
// ".plantIngredients")
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/nc/ird/malariaplantdb/web/rest/AuthorResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.inject.Inject;
Expand Down Expand Up @@ -87,9 +88,12 @@ public ResponseEntity<Author> updateAuthor(@Valid @RequestBody Author author) th
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Transactional(readOnly = true)
public ResponseEntity<List<Author>> getAllAuthors(Pageable pageable)
throws URISyntaxException {
Page<Author> page = authorRepository.findAll(pageable);
// eagerly load the association
page.getContent().stream().forEach(author -> author.getPublication().getTitle());
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/authors");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
Expand All @@ -101,11 +105,15 @@ public ResponseEntity<List<Author>> getAllAuthors(Pageable pageable)
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Transactional(readOnly = true)
public ResponseEntity<Author> getAuthor(@PathVariable Long id) {
log.debug("REST request to get Author : {}", id);
return Optional.ofNullable(authorRepository.findOne(id))
.map(author -> new ResponseEntity<>(
author,
Author author = authorRepository.findOne(id);
// eagerly load the association
author.getPublication().getTitle();
return Optional.ofNullable(author)
.map(aut -> new ResponseEntity<>(
aut,
HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/config/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ spring:
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
data:
elasticsearch:
cluster-nodes: {ELASTICSEARCH_HOST}:9300
cluster-name: ${ELASTICSEARCH_CLUSTER}
cluster-nodes: ${ELASTICSEARCH_HOST}:9300
mail:
host: ${MAIL_HOST}
port: ${MAIL_PORT}
Expand Down

0 comments on commit 69d534f

Please sign in to comment.