Skip to content

Commit

Permalink
Upgrading spark. Tweaking zooming. Fixing docker
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Mar 28, 2018
1 parent f20987c commit 599a18f
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 34 deletions.
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ USER node
RUN npm i -g @angular/cli@latest
USER root

COPY ui/package.json ${UI_PATH}/package.json
WORKDIR ${UI_PATH}
RUN yarn

COPY ui ${UI_PATH}
RUN yarn
RUN ng build -prod -aot


Expand All @@ -22,7 +20,7 @@ COPY service /opt/flowchat/service
COPY --from=node-builder /opt/flowchat/ui/dist /opt/flowchat/service/src/main/resources

WORKDIR /opt/flowchat/service
RUN mvn clean install
RUN mvn clean install -DskipTests


FROM openjdk:8-jre-slim
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ services:
FLOWCHAT_DB_URL: "jdbc:postgresql://flowchat_db/flowchat"
FLOWCHAT_DB_USERNAME: "postgres"
FLOWCHAT_DB_PASSWORD: "example"
SORTING_CREATED_WEIGHT: 3600.0000
SORTING_NUMBER_OF_VOTES_WEIGHT: 0.0010
SORTING_AVG_RANK_WEIGHT: 0.0100

flowchat_db:
image: postgres
Expand Down
2 changes: 1 addition & 1 deletion service/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mvn clean install
pkill -9 -f target/flowchat.jar
unzip -o target/flowchat.jar -d /tmp/.flowchat.tmp
unzip -q -o target/flowchat.jar -d /tmp/.flowchat.tmp
nohup java -jar target/flowchat.jar $@ >> log.out &
4 changes: 2 additions & 2 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
number_of_votes*number_of_votes_weight +
avg_rank*avg_rank_weight-->
<sorting_created_weight>3600</sorting_created_weight>
<sorting_number_of_votes_weight>0.1</sorting_number_of_votes_weight>
<sorting_number_of_votes_weight>0.001</sorting_number_of_votes_weight>
<sorting_avg_rank_weight>0.01</sorting_avg_rank_weight>

<reddit_username></reddit_username>
Expand Down Expand Up @@ -211,7 +211,7 @@
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.5</version>
<version>2.7.1</version>
<exclusions>
<exclusion>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class RedditImporter implements Job {
private RedditClient redditClient;

public void init() {
log.info("got here");

try {
UserAgent myUserAgent = UserAgent.of("desktop", "com.flowchat", "v0.1", "dessalines");
redditClient = new RedditClient(myUserAgent);
Expand Down
11 changes: 11 additions & 0 deletions service/src/main/java/com/chat/tools/Tools.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ public static Properties loadProperties(String propertiesFileLocation) {
case "FLOWCHAT_DB_PASSWORD":
prop.setProperty("jdbc.password", env.get(varName));
break;
case "SORTING_CREATED_WEIGHT":
prop.setProperty("sorting_created_weight", env.get(varName));
break;
case "SORTING_NUMBER_OF_VOTES_WEIGHT":
prop.setProperty("sorting_number_of_votes_weight", env.get(varName));
break;
case "SORTING_AVG_RANK_WEIGHT":
prop.setProperty("sorting_avg_rank_weight", env.get(varName));
break;


}
}

Expand Down
4 changes: 2 additions & 2 deletions service/src/main/java/com/chat/types/SessionScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public static Set<SessionScope> constructFilteredMessageScopesFromSessionRequest
Set<SessionScope> filteredScopes;
Long discussionId = getDiscussionIdFromSession(session);

log.info(Arrays.toString(breadcrumbs.toArray()));
log.info(scopes.toString());
log.debug(Arrays.toString(breadcrumbs.toArray()));
log.debug(scopes.toString());

filteredScopes = scopes.stream()
.filter(s -> s.getDiscussionId().equals(discussionId) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public void checkPrivate(User userObj) {
}

public void checkBlocked(User userObj) {
System.out.println(Arrays.toString(getBlockedUsers().toArray()));
if (getBlockedUsers().contains(userObj)) {
throw new NoSuchElementException("You have been blocked from this discussion");
}
Expand Down
8 changes: 0 additions & 8 deletions service/src/main/java/com/chat/webservice/ChatService.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public class ChatService {
@Option(name="-ssl",usage="The location of the java keystore .jks file.")
private File jks;

@Option(name="-docker",usage="Use the docker container")
private Boolean docker = false;

@Option(name="-liquibase", usage="Run liquibase changeset")
private Boolean liquibase = true;

Expand All @@ -67,11 +64,6 @@ public void doMain(String[] args) {
DataSources.SSL = true;
}

if (docker) {
DataSources.PROPERTIES.setProperty("jdbc.url", "jdbc:postgresql://db/flowchat");
DataSources.PROPERTIES.setProperty("jdbc.password", "test");
}

if (liquibase) {
Tools.runLiquibase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void onClose(Session session, int statusCode, String reason) {

broadcastMessage(filteredScopes, Users.create(SessionScope.getUserObjects(filteredScopes)).json());


}

@OnWebSocketMessage
Expand Down
3 changes: 2 additions & 1 deletion ui/angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": [
"../node_modules/autosize/dist/autosize.min.js",
"../node_modules/markdown-it-emoji/dist/markdown-it-emoji.min.js",
"../node_modules/favico.js/favico-0.3.10.min.js"
"../node_modules/favico.js/favico-0.3.10.min.js",
"../node_modules/imagesloaded/imagesloaded.pkgd.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"rxjs": "^5.5.2",
"ts-helpers": "^1.1.1",
"zone.js": "^0.8.4",
"zooming": "^1.2.4"
"zooming": "^1.4.2"
},
"devDependencies": {
"@angular/cli": "^1.7.3",
Expand Down
11 changes: 2 additions & 9 deletions ui/src/app/shared/tools.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import * as Zooming from 'zooming';
import Zooming from 'zooming';

export class Tools {
static zooming = new Zooming({
enableGrab: false,
preloadImage: false,
closeOnWindowResize: true,
transitionDuration: 0.2,
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0, 1)',
bgColor: 'rgb(0,0,0)',
bgOpacity: 1,
scaleBase: 1.0,
scaleExtra: 0.5,
scrollThreshold: 40,
zIndex: 998,
transitionDuration: 0.2
});

static createCookie(name: string, value: any, expireTime: number) {
Expand Down
1 change: 0 additions & 1 deletion ui/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
<body>
<app-root>Loading...</app-root>
<script>window.__theme = 'bs4';</script>
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6889,6 +6889,6 @@ zone.js@^0.8.4:
version "0.8.17"
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.17.tgz#4c5e5185a857da8da793daf3919371c5a36b2a0b"

zooming@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/zooming/-/zooming-1.2.4.tgz#31cd79ec3525f218351f67c56cbd6a84dff4a5fa"
zooming@^1.4.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/zooming/-/zooming-1.4.2.tgz#42e27d0b604d2ca5d18ecd64df507fd9f0fdc09d"

0 comments on commit 599a18f

Please sign in to comment.