Commit e8bd5abe authored by jnaud's avatar jnaud
Browse files

Use geonetwork 3.10.2.

parent 75039ecb
Pipeline #15901 failed with stages
in 3 minutes and 14 seconds
/target
/source
\ No newline at end of file
/source
/.metadata
/.settings
/.classpath
/.project
\ No newline at end of file
# Geosource
## Download dependency
```bash
mkdir source
cd source
wget -O geonetwork-3.8.3-0.war https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v3.8.3/geonetwork.war/download
wget -O geonetwork-3.10.2-0.war https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v3.10.2/geonetwork.war/download
cd ..
```
## Build geosource war in local maven repository
# install geosource war in local maven repository
#./mvnw install:install-file -DgroupId=org.geonetwork-opensource -DartifactId=geosource -Dversion=3.0.1-0 -Dpackaging=war -Dfile=./source/geosource-3.0.1-0.war
./mvnw install:install-file -DgroupId=org.geonetwork-opensource -DartifactId=geonetwork -Dversion=3.8.3-0 -Dpackaging=war -Dfile=./source/geonetwork-3.8.3-0.war && ./mvnw clean package
# build war overlay
./mvnw clean package
\ No newline at end of file
```bash
./mvnw install:install-file -DgroupId=org.geonetwork-opensource -DartifactId=geonetwork -Dversion=3.10.2-0 -Dpackaging=war -Dfile=./source/geonetwork-3.10.2-0.war && ./mvnw clean package
```
\ No newline at end of file
pipeline {
agent any
options { disableConcurrentBuilds() }
stages {
stage('Fetch dependencies') {
agent any
steps {
sh 'cicd/build/0_fetch-dependencies.sh'
stash includes: 'node_modules/', name: 'node_modules'
}
}
stage('Lint') {
agent any
steps {
unstash 'node_modules'
sh 'cicd/build/1_lint.sh'
}
}
stage('Build prod') {
agent any
steps {
unstash 'node_modules'
sh 'cicd/build/3_build-prod.sh'
stash includes: 'dist/', name: 'dist'
}
}
stage('Make release') {
agent any
steps {
unstash 'dist'
sh 'cicd/build/5_make_release.sh'
stash includes: 'jenkins_release/', name: 'jenkins_release'
}
}
stage('Make docker') {
agent any
steps {
unstash 'jenkins_release'
sh 'cicd/build/6_make_docker.sh'
stash includes: 'jenkins_release/', name: 'jenkins_release'
}
}
}
post {
success {
unstash 'jenkins_release'
archiveArtifacts artifacts: 'jenkins_release/*.tar.gz', onlyIfSuccessful: true
archiveArtifacts artifacts: 'jenkins_release/*.docker', onlyIfSuccessful: true
}
always {
sh 'cicd/build/99_clean.sh'
}
}
}
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
. $SCRIPTDIR/env.sh
# Create docker
docker run \
-d \
--name $DOCKER_NAME \
-v "$SCRIPTDIR/../..":/home/node/app \
-w /home/node/app \
node:12-stretch \
sh -c 'while sleep 3600; do :; done'
# Run in daemon process
# Define the container name
# Mount this code in the container
# Define the default working directory
# Docker image used
# Command wait infinitly compatible with many docker image
# Modify user right
docker exec $DOCKER_NAME \
/bin/bash -c "chown -R node:node /home/node/app;"
# Exec
docker exec --user node:node $DOCKER_NAME /bin/bash -c " \
set -e; \
npm install;"
# Reset user right
USER_ID=`id -u`
GROUP_ID=`id -g`
docker exec $DOCKER_NAME /bin/bash -c " \
chown -R $USER_ID:$GROUP_ID /home/node/app"
# Stop docker
docker rm -f $DOCKER_NAME
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
. $SCRIPTDIR/env.sh
# Create docker
docker run \
-d \
--name $DOCKER_NAME \
-v "$SCRIPTDIR/../..":/home/node/app \
-w /home/node/app \
node:12-stretch \
sh -c 'while sleep 3600; do :; done'
# Run in daemon process
# Define the container name
# Mount this code in the container
# Define the default working directory
# Docker image used
# Command wait infinitly compatible with many docker image
# Modify user right
docker exec $DOCKER_NAME \
/bin/bash -c "chown -R node:node /home/node/app;"
# Exec
docker exec --user node:node $DOCKER_NAME /bin/bash -c " \
set -e; \
npm run lint;"
# Reset user right
USER_ID=`id -u`
GROUP_ID=`id -g`
docker exec $DOCKER_NAME /bin/bash -c " \
chown -R $USER_ID:$GROUP_ID /home/node/app"
# Stop docker
docker rm -f $DOCKER_NAME
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
. $SCRIPTDIR/env.sh
# Create docker
docker run \
-d \
--name $DOCKER_NAME \
-v "$SCRIPTDIR/../..":/home/node/app \
-w /home/node/app \
node:12-stretch \
sh -c 'while sleep 3600; do :; done'
# Run in daemon process
# Define the container name
# Mount this code in the container
# Define the default working directory
# Docker image used
# Command wait infinitly compatible with many docker image
# Modify user right
docker exec $DOCKER_NAME \
/bin/bash -c "chown -R node:node /home/node/app;"
# Exec
docker exec --user node:node $DOCKER_NAME /bin/bash -c " \
set -e; \
npm run e2e;"
# Reset user right
USER_ID=`id -u`
GROUP_ID=`id -g`
docker exec $DOCKER_NAME /bin/bash -c " \
chown -R $USER_ID:$GROUP_ID /home/node/app"
# Stop docker
docker rm -f $DOCKER_NAME
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
. $SCRIPTDIR/env.sh
# Create docker
docker run \
-d \
--name $DOCKER_NAME \
-v "$SCRIPTDIR/../..":/home/node/app \
-w /home/node/app \
node:12-stretch \
sh -c 'while sleep 3600; do :; done'
# Run in daemon process
# Define the container name
# Mount this code in the container
# Define the default working directory
# Docker image used
# Command wait infinitly compatible with many docker image
# Modify user right
docker exec $DOCKER_NAME \
/bin/bash -c "chown -R node:node /home/node/app;"
# Exec
docker exec --user node:node $DOCKER_NAME /bin/bash -c " \
set -e; \
npm run prod;"
# Reset user right
USER_ID=`id -u`
GROUP_ID=`id -g`
docker exec $DOCKER_NAME /bin/bash -c " \
chown -R $USER_ID:$GROUP_ID /home/node/app"
# Stop docker
docker rm -f $DOCKER_NAME
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
COMMIT=`git rev-parse --short=8 HEAD`
DATE="`date '+%Y%m%dT%H%M'`"
. $SCRIPTDIR/env.sh
# Make release
mkdir -p jenkins_release/${PROJECT_NAME}
cp -r dist/jpr_prodige_geosource/* jenkins_release/${PROJECT_NAME}/
cd jenkins_release
tar -czf ${PROJECT_NAME}_${COMMIT}_${DATE}.tar.gz ${PROJECT_NAME}
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
COMMIT=`git rev-parse --short=8 HEAD`
DATE="`date '+%Y%m%dT%H%M'`"
. $SCRIPTDIR/env.sh
# Build docker
docker build -t ${PROJECT_NAME}:${COMMIT} -f cicd/build/docker/Dockerfile .
# Save image
docker save ${PROJECT_NAME}:${COMMIT} | gzip > jenkins_release/${PROJECT_NAME}_${COMMIT}_${DATE}.docker
#!/bin/sh
set -e
# Source env file
SCRIPT=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPT`
SCRIPTNAME=`basename $SCRIPT`
. $SCRIPTDIR/env.sh
if [ ! "$(docker ps -q -f name=$DOCKER_NAME)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=$DOCKER_NAME)" ]; then
# Clean docker
docker rm -f $DOCKER_NAME
fi
# Create docker
docker run \
-d \
--name $DOCKER_NAME \
-v "$SCRIPTDIR/../..":/home/node/app \
-w /home/node/app \
node:12-stretch \
sh -c 'while sleep 3600; do :; done'
fi
# Reset user right
USER_ID=`id -u`
GROUP_ID=`id -g`
docker exec $DOCKER_NAME /bin/bash -c " \
chown -R $USER_ID:$GROUP_ID /home/node/app"
# Clean docker
docker rm -f $DOCKER_NAME
FROM nginx:1.17-alpine
# Copy src
COPY --chown=nginx:nginx jenkins_release/jpr_prodige_geosource /home/www
COPY --chown=root:root cicd/build/docker/nginx.conf /etc/nginx/conf.d/default.conf
version: '3'
services:
web:
image: jpr_prodige_geosource # Docker image name
container_name: jpr_prodige_geosource # Docker container name
build: . # Build images with this ./Dockerfile
ports:
- "8080:80"
server {
listen 80;
root /home/www;
location / {
try_files $uri $uri/ /index.html;
}
}
#!/bin/bash
PROJECT_NAME="jpr_prodige_geosource"
DOCKER_NAME="${PROJECT_NAME}_build"
/docker-compose.env
\ No newline at end of file
# https://hub.docker.com/
FROM tomcat:9-jdk8-openjdk
ADD source/ /usr/local/tomcat/webapps/
EXPOSE 8080
CMD ["catalina.sh", "run"]
\ No newline at end of file
# README
<!-- TOC -->
- [README](#readme)
- [Overview](#overview)
- [Start developpement](#start-developpement)
- [Stop developpement](#stop-developpement)
- [General Docker commands](#general-docker-commands)
- [Advanced Docker commands](#advanced-docker-commands)
- [Clean commands](#clean-commands)
- [Monitoring commands](#monitoring-commands)
<!-- /TOC -->
## Overview
This file give commands to start development with docker.
Require:
- Docker installed.
- Docker well configured, cf. **/etc/docker/deamon.json**
- User in docker group to avoid sudo/su right
## Start developpement
Make these commands in this directory ```cd ./cicd/dev```.
Run container
```bash
# Put UID and GID in env file
echo -e "LOCAL_USER_ID=$(id -u)\nLOCAL_GROUP_ID=$(id -g)" > docker-compose.env
# Build dev image
docker-compose build
# Run containers
docker-compose up
```
In an other terminal, connect as www-data to the dev container
```bash
# Connect to container as node
docker exec --user node -w /home/node/app -it jpr_prodige_geosource_dev_web bash
```
In container
```bash
# Install
npm install
# Serve
npm run dev
```
The url web site are http://localhost:4200
## Stop developpement
Make these commands in this directory ```cd ./cicd/dev```.
```bash
# Shutdown containers
docker-compose down
# Remove dev image
docker rmi jpr_prodige_geosource_dev_web
```
## General Docker commands
| Description | Commandes |
|- |- |
| Display images | ```docker images``` |
| Remove image | ```docker rmi myimages``` |
|- |- |
| Display all running containers | ```docker ps``` |
| Display all containers | ```docker ps -a``` |
| Remove container | ```docker rm mycontainer``` |
| Display info container | ```docker inpect mycontainer``` |
| Display container ouput | ```docker logs mycontainer``` |
| Stop container | ```docker stop mycontainer``` |
| Kill container | ```docker kill mycontainer``` |
|- |- |
| Connection as root | ```docker exec --user 0 -w / -it jpr_prodige_geosource_dev_web bash``` |
| Connection as www-data | ```docker exec --user www-data -w /var/www/html -it jpr_prodige_geosource_dev_web bash``` |
| Connection as postgres | ```docker exec --user postgres -it tpl_alkante_symfony_3_dev_db bash``` |
| Run composer install | ```docker exec --user www-data -w /var/www/html -it jpr_prodige_geosource_dev_web composer install ``` |
## Advanced Docker commands
### Clean commands
```bash
# Stop all container
docker stop $(docker ps -a -q)
# Remove all container
docker rm $(docker ps -a -q)
# Delete all image with name or tag aas "<none>"
docker rmi `docker images| egrep "<none>" |awk '{print $3}'`
```
### Monitoring commands
```bash
# Watch all container
watch -n 1 "docker ps -a"
# Watch all images
watch -n 1 "docker images"
# Watch all resources container
docker stats
```
version: '3'
services:
web:
image: jpr_prodige_geosource_dev_web # Docker image name
container_name: jpr_prodige_geosource_dev_web # Docker container name
build: . # Build images with this ./Dockerfile
volumes:
- ../..:/home/node/app # Mount this code sources (../..) in container
environment:
- TZ=Europe/Paris
env_file:
- ./docker-compose.env
ports:
- "4200:4200"
\ No newline at end of file
#!/bin/bash
set -e
echo " # fix uid and gid"
if [ -n "$LOCAL_USER_ID" ]
then
usermod -u $LOCAL_USER_ID node
fi
if [ -n "$LOCAL_GROUP_ID" ]
then
groupmod -g $LOCAL_GROUP_ID node
fi
chown node:node /home/node/app
echo " # sleep infinity"
sleep infinity
\ No newline at end of file
......@@ -6,13 +6,13 @@
<groupId>prodige41.alkante.al</groupId>
<artifactId>geosource-overlay</artifactId>
<packaging>war</packaging>
<version>3.8.3-0</version>
<version>3.10.2-0</version>
<dependencies>
<dependency>
<groupId>org.geonetwork-opensource</groupId>
<artifactId>geonetwork</artifactId>
<version>3.8.3-0</version>
<version>3.10.2-0</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
......
Supports Markdown
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