Commit 15db67f9 authored by Indrek Jentson's avatar Indrek Jentson
Browse files

Muudatused konfiguratsiooni CI-le vastavalt.

parent 7bd79bf5
Pipeline #307 passed with stage
in 1 minute and 1 second
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stages:
- build
- deploy
build:
stage: build
only:
- master
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- echo CI_REGISTRY_IMAGE $CI_REGISTRY_IMAGE
- /kaniko/executor --context $CI_PROJECT_DIR --cache --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF --destination $CI_REGISTRY_IMAGE:latest
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kl-lausestaja.iml" filepath="$PROJECT_DIR$/.idea/kl-lausestaja.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
# DOCKERi skript KL-lausestaja ehitamiseks
FROM debian:oldstable
# Kui Debianil pole vaikimisi kaasas GCC vajalikke teeke vms, siis tuleb need ka lasta installida.
RUN apt-get update && \
apt-get -y install curl sudo gnupg apt-utils && \
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - && \
apt-get -y install build-essential nodejs wget && \
apt-get -y install git && echo "Installed 2"
RUN npm install -g forever
# Valmistame ette koodi, mida me DOCKERis kasutama hakkame. Siinkohal peaks plaanima, et mis failid kus kataloogis peaks olema
RUN git clone 'https://gitlab.keeleressursid.ee/keeleliin/keeleliin-wrapper.git' --single-branch wrapper && \
mkdir -p /config && mkdir -p /wrapper/files && mkdir -p /wrapper/tmp && mkdir -p /wrapper/logs && \
cd wrapper && npm install && \
chmod +x *.sh && \
echo "NPM is installed"
FROM registry.gitlab.keeleressursid.ee/keeleliin/keeleliin-service-base:latest
# Määratleme aktiivse töökataloogi
......@@ -32,7 +14,7 @@ WORKDIR /wrapper
RUN apt-get -y install perl && \
git clone 'https://github.com/EstSyntax/EstCG.git'
COPY config_dist.js /wrapper/config.js
COPY config_dist.js /wrapper/config_dist.js
COPY command.sh /wrapper
COPY EstCGFix/json2mrf.pl /wrapper/EstCG/json2mrf.pl
COPY EstCGFix/rtolkija.pl /wrapper/EstCG/rtolkija.pl
......@@ -43,9 +25,6 @@ COPY EstCGFix/rlausestaja.pl /wrapper/EstCG/rlausestaja.pl
# Expose port
EXPOSE 3010
VOLUME ["/config"]
VOLUME ["/wrapper/logs"]
VOLUME ["/wrapper/files"]
VOLUME ["/wrapper/tmp"]
VOLUME ["/config", "/wrapper/logs", "/wrapper/files", "/wrapper/tmp"]
CMD /wrapper/docker_start.sh
NAME=$(grep -Po " id: '\K.*?(?=')" config_dist.js)
echo "Building image for service $NAME"
docker build --no-cache -t $NAME:latest .
\ No newline at end of file
PORT=$(grep -Po 'port: \K.*?(?=,)' config_dist.js)
NAME=$(grep -Po " id: '\K.*?(?=')" config_dist.js)
echo "Running service $NAME on port $PORT"
docker run --name kl_redis -d redis || true
mkdir -p /srv/kl/$NAME/config
mkdir -p /srv/kl/$NAME/logs
mkdir -p /srv/kl/$NAME/files
mkdir -p /srv/kl/$NAME/tmp
docker run --name $NAME -it -d --link kl_redis:redis \
-p $PORT:$PORT \
-v /srv/kl/$NAME/config:/config \
-v /srv/kl/$NAME/logs:/wrapper/logs \
-v /srv/kl/$NAME/files:/wrapper/files \
-v /srv/kl/$NAME/tmp:/wrapper/tmp \
$NAME
NAME=$(grep -Po " id: '\K.*?(?=')" config_dist.js)
echo "Stopping service $NAME"
docker stop $NAME
docker rm $NAME
PORT=$(grep -Po 'port: \K.*?(?=,)' config_dist.js)
NAME=$(grep -Po " id: '\K.*?(?=')" config_dist.js)
echo "Testing service $NAME on port $PORT"
echo "Service description"
curl -I http://127.0.0.1:$PORT > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Service check"
curl -I http://127.0.0.1:$PORT/api/v1/check > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Service statistics"
curl -I http://127.0.0.1:$PORT/api/v1/statistics > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Service config"
curl -I http://127.0.0.1:$PORT/api/v1/service/config > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Functional test"
cp README.MD $NAME-test-input.txt
curl --form content=@$NAME-test-input.txt http://127.0.0.1:$PORT/api/v1/service > $NAME-test.txt
echo ""
SID=$(grep -Po '"sessionId":"\K.*?(?=")' $NAME-test.txt)
status=$(grep -Po '"message":"\K.*?(?=")' $NAME-test.txt)
echo "Session $SID - $status"
rm $NAME-test.txt
rm $NAME-test-input.txt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment