Added deploy script, fixed pom file to build a true fat jar.
This commit is contained in:
		
							parent
							
								
									05487443f2
								
							
						
					
					
						commit
						1f50d31815
					
				| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Simple script to deploy to d-package-search.andrewlalis.com
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mvn clean package
 | 
				
			||||||
 | 
					jarfile=$(find target/d-package-search-*.jar)
 | 
				
			||||||
 | 
					echo "Built JAR: $jarfile"
 | 
				
			||||||
 | 
					ssh -f root@andrewlalis.com 'systemctl stop d-package-search && rm -rf /opt/d-package-search/package-index'
 | 
				
			||||||
 | 
					echo "Shut down d-package-search service."
 | 
				
			||||||
 | 
					scp $jarfile root@andrewlalis.com:/opt/d-package-search/d-package-search.jar
 | 
				
			||||||
 | 
					echo "Uploaded JAR."
 | 
				
			||||||
 | 
					scp -r package-index root@andrewlalis.com:/opt/d-package-search/package-index
 | 
				
			||||||
 | 
					echo "Uploaded package-index."
 | 
				
			||||||
 | 
					ssh -f root@andrewlalis.com 'systemctl start d-package-search'
 | 
				
			||||||
 | 
					echo "Started d-package-search service."
 | 
				
			||||||
							
								
								
									
										30
									
								
								pom.xml
								
								
								
								
							
							
						
						
									
										30
									
								
								pom.xml
								
								
								
								
							| 
						 | 
					@ -42,27 +42,29 @@
 | 
				
			||||||
        <plugins>
 | 
					        <plugins>
 | 
				
			||||||
            <plugin>
 | 
					            <plugin>
 | 
				
			||||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
					                <groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
                <artifactId>maven-assembly-plugin</artifactId>
 | 
					                <artifactId>maven-shade-plugin</artifactId>
 | 
				
			||||||
                <version>3.6.0</version>
 | 
					                <version>3.5.1</version>
 | 
				
			||||||
                <configuration>
 | 
					 | 
				
			||||||
                    <archive>
 | 
					 | 
				
			||||||
                        <manifest>
 | 
					 | 
				
			||||||
                            <mainClass>com.andrewlalis.d_package_search.DPackageSearch</mainClass>
 | 
					 | 
				
			||||||
                        </manifest>
 | 
					 | 
				
			||||||
                    </archive>
 | 
					 | 
				
			||||||
                    <descriptorRefs>
 | 
					 | 
				
			||||||
                        <descriptorRef>jar-with-dependencies</descriptorRef>
 | 
					 | 
				
			||||||
                    </descriptorRefs>
 | 
					 | 
				
			||||||
                </configuration>
 | 
					 | 
				
			||||||
                <executions>
 | 
					                <executions>
 | 
				
			||||||
                    <execution>
 | 
					                    <execution>
 | 
				
			||||||
                        <id>make-assembly</id>
 | 
					 | 
				
			||||||
                        <phase>package</phase>
 | 
					                        <phase>package</phase>
 | 
				
			||||||
                        <goals>
 | 
					                        <goals>
 | 
				
			||||||
                            <goal>single</goal>
 | 
					                            <goal>shade</goal>
 | 
				
			||||||
                        </goals>
 | 
					                        </goals>
 | 
				
			||||||
                    </execution>
 | 
					                    </execution>
 | 
				
			||||||
                </executions>
 | 
					                </executions>
 | 
				
			||||||
 | 
					                <configuration>
 | 
				
			||||||
 | 
					                    <minimizeJar>true</minimizeJar>
 | 
				
			||||||
 | 
					                    <createDependencyReducedPom>false</createDependencyReducedPom>
 | 
				
			||||||
 | 
					                    <transformers>
 | 
				
			||||||
 | 
					                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
 | 
				
			||||||
 | 
					                            <manifestEntries>
 | 
				
			||||||
 | 
					                                <Main-Class>com.andrewlalis.d_package_search.DPackageSearch</Main-Class>
 | 
				
			||||||
 | 
					                                <Multi-Release>true</Multi-Release>
 | 
				
			||||||
 | 
					                            </manifestEntries>
 | 
				
			||||||
 | 
					                        </transformer>
 | 
				
			||||||
 | 
					                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
 | 
				
			||||||
 | 
					                    </transformers>
 | 
				
			||||||
 | 
					                </configuration>
 | 
				
			||||||
            </plugin>
 | 
					            </plugin>
 | 
				
			||||||
        </plugins>
 | 
					        </plugins>
 | 
				
			||||||
    </build>
 | 
					    </build>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,11 @@ public class LucenePackageSearcher implements PackageSearcher {
 | 
				
			||||||
            "readme", 0.25f
 | 
					            "readme", 0.25f
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * The maximum number of results to show.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private static final int MAX_RESULTS = 10;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Path indexPath;
 | 
					    private final Path indexPath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public LucenePackageSearcher(Path indexPath) {
 | 
					    public LucenePackageSearcher(Path indexPath) {
 | 
				
			||||||
| 
						 | 
					@ -49,8 +54,8 @@ public class LucenePackageSearcher implements PackageSearcher {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try (DirectoryReader dirReader = DirectoryReader.open(FSDirectory.open(indexPath))) {
 | 
					        try (DirectoryReader dirReader = DirectoryReader.open(FSDirectory.open(indexPath))) {
 | 
				
			||||||
            IndexSearcher searcher = new IndexSearcher(dirReader, Executors.newVirtualThreadPerTaskExecutor());
 | 
					            IndexSearcher searcher = new IndexSearcher(dirReader, Executors.newVirtualThreadPerTaskExecutor());
 | 
				
			||||||
            TopDocs topDocs = searcher.search(luceneQuery, 25, Sort.RELEVANCE, false);
 | 
					            TopDocs topDocs = searcher.search(luceneQuery, MAX_RESULTS, Sort.RELEVANCE, false);
 | 
				
			||||||
            List<PackageSearchResult> results = new ArrayList<>(25);
 | 
					            List<PackageSearchResult> results = new ArrayList<>(MAX_RESULTS);
 | 
				
			||||||
            for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
 | 
					            for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
 | 
				
			||||||
                Document doc = searcher.storedFields().document(scoreDoc.doc);
 | 
					                Document doc = searcher.storedFields().document(scoreDoc.doc);
 | 
				
			||||||
                results.add(prepareResult(
 | 
					                results.add(prepareResult(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue