Skip to content

Commit

Permalink
Merge branch 'work/using-react-with-bootstrap4'
Browse files Browse the repository at this point in the history
  • Loading branch information
steinarb committed Feb 22, 2021
2 parents fd8bf2d + 80d1588 commit dab73e2
Show file tree
Hide file tree
Showing 14 changed files with 726 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.project
.settings/
/README.md
/TAGS
/ukelonn.gogoshell/runner/
node_modules/
target/
62 changes: 61 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ To set the default to English, and to get English text on the prepopulated datab
config:update
#+end_example

*** Docker image
There is a docker image of the demo version of the application at docker hub: [[https://hub.docker.com/repository/docker/steinarb/ukelonn-demo][ukelonn-demo]].

Start with:
#+begin_examplea
docker pull steinarb/ukelonn-demo:latest
docker run -p 8101:8101 -p 8181:8181 -d steinarb/ukelonn-demo:latest
#+end_example

Then connect to http://docker-container-host:8181/ukelonn with a web browser (replace docker-container-host with whatever host docker is running on), possible logins are:
| username | password | comment |
|----------+----------+----------------------------------------------|
| admin | admin | Admin user, can add new users and work tasks |
| jad | 1ad | Regular user, can register work done |

The demo version use an in-container derby databse that works while the container is up but dies with the container.

* Status

[[https://travis-ci.org/steinarb/ukelonn][file:https://travis-ci.org/steinarb/ukelonn.svg?branch=master]] [[https://coveralls.io/r/steinarb/ukelonn][file:https://coveralls.io/repos/steinarb/ukelonn/badge.svg]] [[https://sonarcloud.io/dashboard/index/no.priv.bang.ukelonn%3Aukelonn][file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.ukelonn%3Aukelonn&metric=alert_status#.svg]]
Expand Down Expand Up @@ -82,7 +99,10 @@ Jeg har også plan om å lage en branch med en versjon som bruker [[http://spark

* Kjapp test av programvaren uten å bygge koden

Det er mulig å teste programvaren uten å sjekke ut og bygge kode. I denne testen kjører man mot en derby-database som settes opp med dummy-data.
Det er flere muligheter til å teste programvaren uten å sjekke ut og bygge kode.

** Med dummy-data i en derby-database
I denne testen kjører man mot en derby-database som settes opp med dummy-data.

Framgangsmåten er som følger:
1. Følge Apache Karaf quick start guide https://karaf.apache.org/manual/latest/quick-start.html
Expand All @@ -103,9 +123,49 @@ Framgangsmåten er som følger:
- Vanlig bruker kan registrere nye jobber og sjekke saldo
- For en administrator-bruker, brukernavn/passord: admin/admin
- Administrator-bruker kan registrere utbetalinger, legge inn nye jobbtyper og endre eksisterende, legge inn nye utbetalinger og justere på eksisterende, og legge inn brukere og endre på eksisterende brukere
** Kjøring i docker-container

*** Demo-image med dummy-data
Dette docker-image't bruker samme dummy-database som [[Med dummy-data i en derby-database]].

Last ned image fra docker hub og start image med:
#+begin_example
docker pull steinarb/ukelonn-demo:latest
docker run -p 8101:8101 -p 8181:8181 -d steinarb/ukelonn-demo:latest
#+end_example

Åpne en nettleser mot http://docker-container-host:8181/ukelonn (erstatt docker-container-host med maskinen docker kjører på), mulige testbrukere, er:
| brukernavn | passord | kommentar |
|------------+---------+-----------------------------------------------------------------------------------------|
| admin | admin | Admin-bruker, kan legge til nye brukere, nye arbeidsoppgaver og registrere utbetalinger |
| jad | 1ad | Vanlig bruker, kan registrere utførte arbeidsoppgaver |

Databasen som kjører er en ekte SQL-database men kjører kun i minnet så endringer blir ikke persistert og blir borte når karaf-prosessen blir stoppet.

*** Docker-image med PostgreSQL-database

Dette imaget trenger en blank PostgresSQL-database og vil sette opp skjema og fylle den opp med initielle data.

Framgangsmåten er som følger:
1. Gå til [[https://www.elephantsql.com/plans.html][ElephantSQL]] og enten lag en bruker der eller logg inn med en github-bruker og opprett en database
2. Ta vare på oppkoblingsinformasjonen for databasen, f.eks.
| url | jdbc:postgresql://lazzie.db.elephantsql.com:5432/mrpdrgft |
| user | mrpdrgft |
| password | 78TPpFgp7NFwFmF1nVr1F2LnzKR_1TfT |
| default database | mrpdrgft |
3. Last ned image fra docker hub og start image med:
#+begin_example
docker pull steinarb/ukelonn:latest
docker run --env JDBC_URL=jdbc:postgresql://lazzie.db.elephantsql.com:5432/mrpdrgft --env JDBC_USER=mrpdrgft --env JDBC_PASSWORD=78TPpFgp7NFwFmF1nVr1F2LnzKR_1TfT -p 8181:8181 -d steinarb/ukelonn:latest
#+end_example
4. Åpne en nettleser mot port 8181 på vertsmaskinen http://myhost.mydomain.com:8181/ukelonn
5. Logg inn med:
| user | password |
|-------+----------|
| admin | admin |
6. Opprett den/de admin-brukerene du vil ha og den/de vanlige brukerene du vil ha


* Beskrivelse av koden
(/Beskriver versjonen fra master/)

Expand Down
76 changes: 76 additions & 0 deletions docker/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xml:space="preserve">

<!-- Copyright 2020 Steinar Bang -->
<!-- -->
<!-- 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. -->

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>no.priv.bang.ukelonn</groupId>
<artifactId>ukelonn</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>no.priv.bang.ukelonn.docker</groupId>
<artifactId>docker</artifactId>
<packaging>pom</packaging>

<name>ukelonn webapp docker images</name>

<modules>
<module>ukelonn-demo</module>
<module>ukelonn</module>
</modules>

<properties>
<skip.docker>true</skip.docker>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
<skipDocker>${skip.docker}</skipDocker>
<baseImage>apache/karaf:${karaf.version}</baseImage>
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>enable-docker-on-linux</id>
<properties>
<skip.docker>false</skip.docker>
</properties>
<activation>
<file>
<exists>/var/run/docker.pid</exists>
</file>
</activation>
</profile>
</profiles>
</project>
3 changes: 3 additions & 0 deletions docker/ukelonn-demo/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM apache/karaf:4.2.9
COPY org.ops4j.pax.url.mvn.cfg /opt/apache-karaf/etc
COPY org.apache.karaf.features.cfg /opt/apache-karaf/etc
97 changes: 97 additions & 0 deletions docker/ukelonn-demo/docker/org.apache.karaf.features.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
################################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#
################################################################################

#
# Comma separated list of features repositories to register by default
#
featuresRepositories = \
mvn:org.apache.karaf.features/standard/4.2.9/xml/features, \
mvn:org.apache.karaf.features/framework/4.2.9/xml/features, \
mvn:org.apache.karaf.features/enterprise/4.2.9/xml/features, \
mvn:org.apache.karaf.features/spring/4.2.9/xml/features, \
mvn:no.priv.bang.ukelonn/karaf/LATEST/xml/features

#
# Comma separated list of features to install at startup
#
featuresBoot = \
instance/4.2.9, \
package/4.2.9, \
log/4.2.9, \
ssh/4.2.9, \
framework/4.2.9, \
system/4.2.9, \
eventadmin/4.2.9, \
feature/4.2.9, \
shell/4.2.9, \
management/4.2.9, \
service/4.2.9, \
jaas/4.2.9, \
deployer/4.2.9, \
diagnostic/4.2.9, \
wrap/2.6.2, \
bundle/4.2.9, \
config/4.2.9, \
kar/4.2.9, \
ukelonn-with-derby

#
# Resource repositories (OBR) that the features resolver can use
# to resolve requirements/capabilities
#
# The format of the resourceRepositories is
# resourceRepositories=[xml:url|json:url],...
# for Instance:
#
#resourceRepositories=xml:http://host/path/to/index.xml
# or
#resourceRepositories=json:http://host/path/to/index.json
#

#
# Defines if the boot features are started in asynchronous mode (in a dedicated thread)
#
featuresBootAsynchronous=false

#
# Service requirements enforcement
#
# By default, the feature resolver checks the service requirements/capabilities of
# bundles for new features (xml schema >= 1.3.0) in order to automatically installs
# the required bundles.
# The following flag can have those values:
# - disable: service requirements are completely ignored
# - default: service requirements are ignored for old features
# - enforce: service requirements are always verified
#
#serviceRequirements=default

#
# Store cfg file for config element in feature
#
#configCfgStore=true

#
# Configuration of features processing mechanism (overrides, blacklisting, modification of features)
# XML file defines instructions related to features processing
# versions.properties may declare properties to resolve placeholders in XML file
# both files are relative to ${karaf.etc}
#
#featureProcessing=org.apache.karaf.features.xml
#featureProcessingVersions=versions.properties

0 comments on commit dab73e2

Please sign in to comment.