diff options
author | kurczews <krzysztof.kurczewski@nokia.com> | 2019-02-11 07:35:10 +0100 |
---|---|---|
committer | kurczews <krzysztof.kurczewski@nokia.com> | 2019-02-11 07:50:24 +0100 |
commit | ab3fcaea72ce4acbe670fed9a0f43f9850859374 (patch) | |
tree | 85ef38ecf5957c0df23ecc67e024d5189de063a0 /local-setup/src/main | |
parent | e64f08ac8242a7db6eb3238ee0ad1a30c8aecf0d (diff) |
Rework on simplified local setup
* drop manual-build step
* reuse images already hosted in remotes
Issue-ID: AAI-2049
Change-Id: I7d854734d115b2de3330ee6934d5744b3a1ad17b
Signed-off-by: kurczews <krzysztof.kurczewski@nokia.com>
Diffstat (limited to 'local-setup/src/main')
-rw-r--r-- | local-setup/src/main/docker/docker-compose.yml | 23 | ||||
-rw-r--r-- | local-setup/src/main/docker/haproxy/Dockerfile | 9 | ||||
-rw-r--r-- | local-setup/src/main/docker/haproxy/aai.pem | 84 | ||||
-rw-r--r-- | local-setup/src/main/docker/haproxy/haproxy.cfg | 120 | ||||
-rw-r--r-- | local-setup/src/main/docker/janusgraph/Dockerfile | 37 | ||||
-rwxr-xr-x | local-setup/src/main/docker/janusgraph/entrypoint.sh | 24 | ||||
-rw-r--r-- | local-setup/src/main/java/onap/aai/dto/Model.java | 93 | ||||
-rw-r--r-- | local-setup/src/main/java/onap/aai/dto/ModelGenerator.java | 48 | ||||
-rw-r--r-- | local-setup/src/main/java/onap/aai/util/AaiRequest.java | 62 | ||||
-rw-r--r-- | local-setup/src/main/java/onap/aai/util/Resources.java | 40 |
10 files changed, 0 insertions, 540 deletions
diff --git a/local-setup/src/main/docker/docker-compose.yml b/local-setup/src/main/docker/docker-compose.yml deleted file mode 100644 index 28e7360..0000000 --- a/local-setup/src/main/docker/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: '2' - -services: - - aai-storage: - image: onap/aai-janus-dev - container_name: aai-storage - network_mode: host - - aai-resources: - image: onap/aai-resources - container_name: aai-resources - network_mode: host - - aai-traversal: - image: onap/aai-traversal - container_name: aai-traversal - network_mode: host - - aai-haproxy: - image: onap/aai-haproxy-dev - container_name: aai-haproxy - network_mode: host
\ No newline at end of file diff --git a/local-setup/src/main/docker/haproxy/Dockerfile b/local-setup/src/main/docker/haproxy/Dockerfile deleted file mode 100644 index 121b698..0000000 --- a/local-setup/src/main/docker/haproxy/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM haproxy:1.6-alpine - -WORKDIR app/ - -COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg - -COPY aai.pem /etc/ssl/private/aai.pem - -RUN chmod 640 /etc/ssl/private/aai.pem && chown root:root /etc/ssl/private/aai.pem
\ No newline at end of file diff --git a/local-setup/src/main/docker/haproxy/aai.pem b/local-setup/src/main/docker/haproxy/aai.pem deleted file mode 100644 index ce97d30..0000000 --- a/local-setup/src/main/docker/haproxy/aai.pem +++ /dev/null @@ -1,84 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFEjCCA/qgAwIBAgIBBjANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQGEwJVUzEN -MAsGA1UECgwET05BUDEOMAwGA1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVk -aWF0ZUNBXzEwHhcNMTgwNjA1MTIxOTU5WhcNMTkwNTMxMTIxOTU5WjBVMQswCQYD -VQQGEwJVUzENMAsGA1UECgwET05BUDEZMBcGA1UECwwQYWFpQGFhaS5vbmFwLm9y -ZzEOMAwGA1UECwwFT1NBQUYxDDAKBgNVBAMMA2FhaTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBAMqVPBjn6pxPhAwRov+ApKxJkuSo/UNbwmc7eYC+eYiY -SB35uI7Bt8UHWxxBNZdHpFbZUOuL2wWb7JYycML8gbsY2YF440K+X+TVTiVGSkv0 -L8MYwDTuCOn9YtlTEkKE6Wth4WPyEN3ZrQD7j7YGNr/3tK61Eeq/A/qhhksbpuTu -ReRDdsXzXTwX2sjZXdixv25YJUStH1pSrAHLz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uFXXdXnoA3PI7J -EJwRkChV4kR0dspAhIZsdfY6yw606IB+NvT48S5gLvMpxC8JGrCjKUkcw4e7lO+c -oxIjEwLmqqYRktRTfWU6SeqrGiiS6/+jERVdVxJysF/0havDkXr27rymiCKb2k2F -82R57RzJC+AYRYrpsJH8dMuA ------END PRIVATE KEY-----
\ No newline at end of file diff --git a/local-setup/src/main/docker/haproxy/haproxy.cfg b/local-setup/src/main/docker/haproxy/haproxy.cfg deleted file mode 100644 index 0fecea0..0000000 --- a/local-setup/src/main/docker/haproxy/haproxy.cfg +++ /dev/null @@ -1,120 +0,0 @@ -global - log /dev/log local0 - stats socket /usr/local/etc/haproxy/haproxy.socket mode 660 level admin - stats timeout 30s - user root - group root - daemon - ################################# - # Default SSL material locations# - ################################# - ca-base /etc/ssl/certs - crt-base /etc/ssl/private - - # Default ciphers to use on SSL-enabled listening sockets. - # For more information, see ciphers(1SSL). This list is from: - # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ - # An alternative list with additional directives can be obtained from - # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy - tune.ssl.default-dh-param 2048 - -defaults - log global - mode http - option httplog -# option dontlognull -# errorfile 400 /etc/haproxy/errors/400.http -# errorfile 403 /etc/haproxy/errors/403.http -# errorfile 408 /etc/haproxy/errors/408.http -# errorfile 500 /etc/haproxy/errors/500.http -# errorfile 502 /etc/haproxy/errors/502.http -# errorfile 503 /etc/haproxy/errors/503.http -# errorfile 504 /etc/haproxy/errors/504.http - - option http-server-close - option forwardfor except 127.0.0.1 - retries 6 - option redispatch - maxconn 50000 - timeout connect 50000 - timeout client 480000 - timeout server 480000 - timeout http-keep-alive 30000 - - -frontend IST_8443 - mode http - bind 0.0.0.0:8443 name https ssl crt /etc/ssl/private/aai.pem -# log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ {%[ssl_c_verify],%{+Q}[ssl_c_s_dn],%{+Q}[ssl_c_i_dn]}\ %{+Q}r - log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC \ %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r" - option httplog - log global - option logasap - option forwardfor - capture request header Host len 100 - capture response header Host len 100 - option log-separate-errors - option forwardfor - http-request set-header X-Forwarded-Proto https if { ssl_fc } - http-request set-header X-AAI-Client-SSL TRUE if { ssl_c_used } - http-request set-header X-AAI-SSL %[ssl_fc] - http-request set-header X-AAI-SSL-Client-Verify %[ssl_c_verify] - http-request set-header X-AAI-SSL-Client-DN %{+Q}[ssl_c_s_dn] - http-request set-header X-AAI-SSL-Client-CN %{+Q}[ssl_c_s_dn(cn)] - http-request set-header X-AAI-SSL-Issuer %{+Q}[ssl_c_i_dn] - http-request set-header X-AAI-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore] - http-request set-header X-AAI-SSL-Client-NotAfter %{+Q}[ssl_c_notafter] - http-request set-header X-AAI-SSL-ClientCert-Base64 %{+Q}[ssl_c_der,base64] - http-request set-header X-AAI-SSL-Client-OU %{+Q}[ssl_c_s_dn(OU)] - http-request set-header X-AAI-SSL-Client-L %{+Q}[ssl_c_s_dn(L)] - http-request set-header X-AAI-SSL-Client-ST %{+Q}[ssl_c_s_dn(ST)] - http-request set-header X-AAI-SSL-Client-C %{+Q}[ssl_c_s_dn(C)] - http-request set-header X-AAI-SSL-Client-O %{+Q}[ssl_c_s_dn(O)] - reqadd X-Forwarded-Proto:\ https - reqadd X-Forwarded-Port:\ 8443 - -####################### -#ACLS FOR PORT 8446#### -####################### - - acl is_Port_8446_generic path_reg -i ^/aai/v[0-9]+/search/generic-query$ - acl is_Port_8446_nodes path_reg -i ^/aai/v[0-9]+/search/nodes-query$ - acl is_Port_8446_version path_reg -i ^/aai/v[0-9]+/query$ - acl is_named-query path_beg -i /aai/search/named-query - acl is_search-model path_beg -i /aai/search/model - use_backend IST_AAI_8446 if is_Port_8446_generic or is_Port_8446_nodes or is_Port_8446_version or is_named-query or is_search-model - - default_backend IST_Default_8447 - - -####################### -#DEFAULT BACKEND 847### -####################### - -backend IST_Default_8447 - balance roundrobin - http-request set-header X-Forwarded-Port %[src_port] - http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload; - server aai-resources.api.simpledemo.openecomp.org localhost:8447 port 8447 ssl verify none - -####################### -# BACKEND 8446######### -####################### - -backend IST_AAI_8446 - balance roundrobin - http-request set-header X-Forwarded-Port %[src_port] - http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload; - server aai-traversal.api.simpledemo.openecomp.org localhost:8446 port 8446 ssl verify none - -listen IST_AAI_STATS - mode http - bind *:8080 - stats uri /stats - stats enable - stats refresh 30s - stats hide-version - stats auth admin:admin - stats show-legends - stats show-desc IST AAI APPLICATION NODES - stats admin if TRUE
\ No newline at end of file diff --git a/local-setup/src/main/docker/janusgraph/Dockerfile b/local-setup/src/main/docker/janusgraph/Dockerfile deleted file mode 100644 index 76c3628..0000000 --- a/local-setup/src/main/docker/janusgraph/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM alpine:3.7 - -WORKDIR app/ - -RUN apk add --no-cache \ - bash \ - openjdk8 \ - unzip \ - wget - -ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/bin/ - -ARG JANUS_VERSION=0.2.0 -ARG JANUS_ARTIFACT=janusgraph-${JANUS_VERSION}-hadoop2 - -RUN wget -q --show-progress --progress=bar:force:noscroll \ - http://github.com/JanusGraph/janusgraph/releases/download/v${JANUS_VERSION}/${JANUS_ARTIFACT}.zip && \ - unzip ${JANUS_ARTIFACT}.zip && \ - rm ${JANUS_ARTIFACT}.zip && \ - mv ${JANUS_ARTIFACT} janusgraph - -# WARN: Instruction above takes long time. Make best effort to insert additional commands below this comment - -CMD ["./entrypoint.sh"] - -COPY entrypoint.sh . - -RUN chmod +x entrypoint.sh - -ARG USER=janusz -ARG GROUP=aai - -RUN addgroup ${GROUP} && adduser -D ${USER} ${GROUP} && chown -R ${USER}:${GROUP} . - -USER ${USER}:${GROUP} - -HEALTHCHECK --interval=40s --timeout=10s --retries=3 CMD janusgraph/bin/janusgraph.sh status
\ No newline at end of file diff --git a/local-setup/src/main/docker/janusgraph/entrypoint.sh b/local-setup/src/main/docker/janusgraph/entrypoint.sh deleted file mode 100755 index 8108866..0000000 --- a/local-setup/src/main/docker/janusgraph/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# run short-living command and prevent docker from stopping - -JANUS_EXEC="janusgraph/bin/janusgraph.sh" - -onStart() { - ${JANUS_EXEC} start -} - -onStop() { - ${JANUS_EXEC} stop -} - -waitLoop() { - tail -f /dev/null & - wait $! -} - -trap 'onStop; exit 0' SIGTERM SIGINT - -onStart || exit $? - -waitLoop
\ No newline at end of file diff --git a/local-setup/src/main/java/onap/aai/dto/Model.java b/local-setup/src/main/java/onap/aai/dto/Model.java deleted file mode 100644 index 1cf9a41..0000000 --- a/local-setup/src/main/java/onap/aai/dto/Model.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2018-2019 Nokia Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package onap.aai.dto; - -import java.util.Arrays; -import java.util.List; - -/** - * Dummy model for testing purposes - */ -@SuppressWarnings("unused") -public class Model { - - private static final String MODEL_TYPE = "widget"; - private static final String MODEL_VERSION = "1.0"; - - private final String modelInvariantId; - private final String modelType; - private final ModelVers modelVers; - - public Model(String modelName, String modelInvariantId, String modelVersionId) { - this.modelInvariantId = modelInvariantId; - this.modelVers = new ModelVers(new ModelVer(modelVersionId, modelName)); - this.modelType = MODEL_TYPE; - } - - public String getModelInvariantId() { - return modelInvariantId; - } - - public ModelVers getModelVers() { - return modelVers; - } - - public String getModelType() { - return modelType; - } - - private static class ModelVers { - - private final List<ModelVer> modelVer; - - ModelVers(ModelVer... modelVer) { - this.modelVer = Arrays.asList(modelVer); - } - - public List<ModelVer> getModelVer() { - return modelVer; - } - } - - private static class ModelVer { - - private final String modelVersionId; - private final String modelVersion; - private final String modelName; - - ModelVer(String modelVersionId, String modelName) { - this.modelVersionId = modelVersionId; - this.modelName = modelName; - this.modelVersion = MODEL_VERSION; - } - - public String getModelVersionId() { - return modelVersionId; - } - - public String getModelName() { - return modelName; - } - - public String getModelVersion() { - return MODEL_VERSION; - } - } -}
\ No newline at end of file diff --git a/local-setup/src/main/java/onap/aai/dto/ModelGenerator.java b/local-setup/src/main/java/onap/aai/dto/ModelGenerator.java deleted file mode 100644 index c6625e1..0000000 --- a/local-setup/src/main/java/onap/aai/dto/ModelGenerator.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2018-2019 Nokia Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package onap.aai.dto; - -import static onap.aai.util.Resources.readerFrom; - -import java.io.IOException; -import java.io.UncheckedIOException; -import java.util.stream.Stream; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; - -public class ModelGenerator { - - public static Stream<Model> generate(String fileName) { - try (CSVParser parser = CSVFormat.DEFAULT.withFirstRecordAsHeader().parse(readerFrom(fileName))) { - return parser.getRecords().stream().map(ModelGenerator::csvToModel); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static Model csvToModel(CSVRecord csvRecord) { - return new Model( - csvRecord.get("model-name"), - csvRecord.get("model-invariant-id"), - csvRecord.get("model-version-id") - ); - } -} diff --git a/local-setup/src/main/java/onap/aai/util/AaiRequest.java b/local-setup/src/main/java/onap/aai/util/AaiRequest.java deleted file mode 100644 index 1875e41..0000000 --- a/local-setup/src/main/java/onap/aai/util/AaiRequest.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2018-2019 Nokia Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package onap.aai.util; - -import com.github.kevinsawicki.http.HttpRequest; - -public class AaiRequest { - - private static final String AAI_BASE_URL = "https://localhost:8443/aai"; - private static final String AAI_AUTH = "Basic QUFJOkFBSQ=="; - private static final String SCHEMA_VERSION = "/v14"; - - public static HttpRequest get(String endpoint) { - return aaiRequest(HttpRequest.get(aaiEndpoint(endpoint))); - } - - public static HttpRequest post(String endpoint) { - return aaiRequest(HttpRequest.post(aaiEndpoint(endpoint))); - } - - public static HttpRequest put(String endpoint) { - return aaiRequest(HttpRequest.put(aaiEndpoint(endpoint))); - } - - public static HttpRequest delete(String endpoint) { - return aaiRequest(HttpRequest.delete(aaiEndpoint(endpoint))); - } - - public static String v14(String endpoint) { - return SCHEMA_VERSION + endpoint; - } - - private static HttpRequest aaiRequest(HttpRequest httpRequest) { - return httpRequest - .header("X-FromAppId", "dummy id") - .header("X-TransactionId", "1234") - .authorization(AAI_AUTH) - .trustAllCerts() - .trustAllHosts(); - } - - private static String aaiEndpoint(String endpoint) { - return AAI_BASE_URL + endpoint; - } -}
\ No newline at end of file diff --git a/local-setup/src/main/java/onap/aai/util/Resources.java b/local-setup/src/main/java/onap/aai/util/Resources.java deleted file mode 100644 index 54d21ec..0000000 --- a/local-setup/src/main/java/onap/aai/util/Resources.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2018-2019 Nokia Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package onap.aai.util; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.stream.Collectors; - -public class Resources { - - public static InputStream inputStreamFrom(String fileName) { - return Resources.class.getClassLoader().getResourceAsStream(fileName); - } - - public static BufferedReader readerFrom(String fileName) { - return new BufferedReader(new InputStreamReader(inputStreamFrom(fileName))); - } - - public static String rawTextFrom(String fileName) { - return readerFrom(fileName).lines().collect(Collectors.joining()); - } -} |