This repository was archived by the owner on Feb 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Initial structure (Mybatis working)
- Loading branch information
Showing
12 changed files
with
487 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
# apollo | ||
Apollo - The logz.io continuous deployement solution over mesos | ||
|
||
## Hacking prerequisites: | ||
``` | ||
pip install django | ||
pip install djangorestframework | ||
pip install markdown | ||
pip install django-filter | ||
pip install logzio-python-handler | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Local mysql docker: | ||
``` | ||
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mavet -e MYSQL_DATABASE=apollo -e MYSQL_USER=apollo -e MYSQL_PASSWORD=tahat -v /Users/roiravhon/github/misc/apollo-mysql:/var/lib/mysql -d mysql:latest | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" /> | ||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.7" level="project" /> | ||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" /> | ||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" /> | ||
<orderEntry type="library" name="Maven: io.logz.logback:logzio-logback-appender:1.0.11" level="project" /> | ||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-quick:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-web:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-gui:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-html:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-render:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-jpa:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-http-server:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-http-fast:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-net:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-buffer:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-inject:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-http-client:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-commons:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-essentials:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.6.6" level="project" /> | ||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.6.0" level="project" /> | ||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.6.6" level="project" /> | ||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-afterburner:2.6.6" level="project" /> | ||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.6.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.15" level="project" /> | ||
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.4.1" level="project" /> | ||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-watch:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-integrate:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.rapidoid:rapidoid-oauth:5.2.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.oltu.oauth2:org.apache.oltu.oauth2.common:1.0.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.json:json:20140107" level="project" /> | ||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" /> | ||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.38" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hsqldb:hsqldb:2.3.3" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:4.3.11.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.1.3.GA" level="project" /> | ||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:4.3.11.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" /> | ||
<orderEntry type="library" name="Maven: org.jboss:jandex:1.1.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" /> | ||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:4.0.5.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.2.4.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.1.0" level="project" /> | ||
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" level="project" /> | ||
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" /> | ||
<orderEntry type="library" name="Maven: javax.el:javax.el-api:2.2.5" level="project" /> | ||
<orderEntry type="library" name="Maven: org.glassfish.web:javax.el:2.2.5" level="project" /> | ||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.5.1" level="project" /> | ||
<orderEntry type="library" name="Maven: com.typesafe:config:1.3.0" level="project" /> | ||
</component> | ||
</module> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DROP TABLE IF EXISTS `users`; | ||
CREATE TABLE `users` ( | ||
`email_address` varchar(100) NOT NULL, | ||
`hashed_password` varchar(1000) NOT NULL, | ||
PRIMARY KEY(`email_address`), | ||
UNIQUE KEY `email_address` (`email_address`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>io.logz.apollo</groupId> | ||
<artifactId>apollo-backend</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.5.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.6</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archive> | ||
<manifest> | ||
<mainClass>io.logz.apollo.ApolloMain</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- | ||
<plugin> | ||
<groupId>com.spotify</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<version>0.4.13</version> | ||
<configuration> | ||
<imageName>registry.internal.logz.io:5000/elasticsearch-benchmark-tool</imageName> | ||
<dockerDirectory>docker</dockerDirectory> | ||
<resources> | ||
<resource> | ||
<targetPath>/packages</targetPath> | ||
<directory>${project.build.directory}</directory> | ||
<include>${project.build.finalName}-jar-with-dependencies.jar</include> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</plugin> | ||
--> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>19.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.1.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-core</artifactId> | ||
<version>1.1.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.21</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.logz.logback</groupId> | ||
<artifactId>logzio-logback-appender</artifactId> | ||
<version>1.0.11</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mybatis</groupId> | ||
<artifactId>mybatis</artifactId> | ||
<version>3.4.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.rapidoid</groupId> | ||
<artifactId>rapidoid-quick</artifactId> | ||
<version>5.2.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.zaxxer</groupId> | ||
<artifactId>HikariCP</artifactId> | ||
<version>2.5.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.typesafe</groupId> | ||
<artifactId>config</artifactId> | ||
<version>1.3.0</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
38 changes: 38 additions & 0 deletions
38
apollo-backend/src/main/java/io/logz/apollo/ApolloMain.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.logz.apollo; | ||
|
||
import io.logz.apollo.configuration.ApolloConfiguration; | ||
import io.logz.apollo.database.ApolloMyBatis; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Created by roiravhon on 11/20/16. | ||
*/ | ||
|
||
public class ApolloMain { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ApolloMain.class); | ||
private static boolean hasError = false; | ||
|
||
public static void main(String[] args) { | ||
|
||
try { | ||
logger.info("Started apollo main"); | ||
ApolloConfiguration apolloConfiguration = ApolloConfiguration.parseConfigurationFromResources(); | ||
ApolloMyBatis.initialize(apolloConfiguration); | ||
|
||
|
||
} catch (RuntimeException e) { | ||
logger.error(e.getMessage(), e); | ||
hasError = true; | ||
|
||
} finally { | ||
logger.info("Cleaning up.."); | ||
ApolloMyBatis.close(); | ||
|
||
if (hasError) { | ||
System.exit(1); | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
apollo-backend/src/main/java/io/logz/apollo/auth/User.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.logz.apollo.auth; | ||
|
||
/** | ||
* Created by roiravhon on 11/20/16. | ||
*/ | ||
public class User { | ||
|
||
private final String emailAddress; | ||
private final String hashedPassword; | ||
|
||
public User(String emailAddress, String hashedPassword) { | ||
this.emailAddress = emailAddress; | ||
this.hashedPassword = hashedPassword; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
apollo-backend/src/main/java/io/logz/apollo/configuration/ApolloConfiguration.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package io.logz.apollo.configuration; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import com.typesafe.config.Config; | ||
import com.typesafe.config.ConfigFactory; | ||
|
||
/** | ||
* Created by roiravhon on 11/20/16. | ||
*/ | ||
public class ApolloConfiguration { | ||
|
||
private final int dbPort; | ||
private final String dbHost; | ||
private final String dbUser; | ||
private final String dbPassword; | ||
private final String dbSchema; | ||
|
||
@VisibleForTesting | ||
public ApolloConfiguration(int dbPort, String dbHost, String dbUser, String dbPassword, String dbSchema) { | ||
this.dbPort = dbPort; | ||
this.dbHost = dbHost; | ||
this.dbUser = dbUser; | ||
this.dbPassword = dbPassword; | ||
this.dbSchema = dbSchema; | ||
} | ||
|
||
public static ApolloConfiguration parseConfigurationFromResources() { | ||
|
||
Config config = ConfigFactory.load(); | ||
int dbPort = config.getInt("apollo.db.port"); | ||
String dbHost = config.getString("apollo.db.host"); | ||
String dbUser = config.getString("apollo.db.user"); | ||
String dbPassword = config.getString("apollo.db.password"); | ||
String dbSchema = config.getString("apollo.db.schema"); | ||
|
||
return new ApolloConfiguration(dbPort, dbHost, dbUser, dbPassword, dbSchema); | ||
} | ||
|
||
public int getDbPort() { | ||
return dbPort; | ||
} | ||
|
||
public String getDbHost() { | ||
return dbHost; | ||
} | ||
|
||
public String getDbUser() { | ||
return dbUser; | ||
} | ||
|
||
public String getDbPassword() { | ||
return dbPassword; | ||
} | ||
|
||
public String getDbSchema() { | ||
return dbSchema; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
apollo-backend/src/main/java/io/logz/apollo/dao/UserDao.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.logz.apollo.dao; | ||
|
||
import io.logz.apollo.auth.User; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by roiravhon on 11/20/16. | ||
*/ | ||
public interface UserDao { | ||
|
||
User getUser(String emailAddress); | ||
List<User> getAllUsers(); | ||
void addUser(String emailAddress, String hashedPassword); | ||
} |
Oops, something went wrong.