No description
Find a file
2021-01-31 19:43:39 +03:00
core improve install documentation 2021-01-31 19:43:39 +03:00
core-alpine first commit 2020-09-24 10:29:28 +03:00
maven improve readme 2020-10-12 16:40:10 +03:00
mongodb improve install documentation 2021-01-31 19:43:39 +03:00
openldap improve install documentation 2021-01-31 19:43:39 +03:00
release improve install documentation 2021-01-31 19:43:39 +03:00
core-as-root.sh improve install documentation 2021-01-31 19:43:39 +03:00
core.sh improve install documentation 2021-01-31 19:43:39 +03:00
docker-compose.yaml improve install documentation 2021-01-31 19:43:39 +03:00
LICENSE first commit 2020-09-24 10:29:28 +03:00
mongodb-as-root.sh improve install documentation 2021-01-31 19:43:39 +03:00
mongodb.sh improve install documentation 2021-01-31 19:43:39 +03:00
openldap.sh improve install documentation 2021-01-31 19:43:39 +03:00
README.adoc improve install documentation 2021-01-31 19:43:39 +03:00

:toc: left
:toc-title: Content
:toclevels: 3
:sectnums:
:sectnumlevels: 3
:docinfo: shared


= Form Management System
telman şahbazoğlu <tsahbazoglu@tspb.org.tr>
v1.0.0, 2018-03-06
:title-logo-image: image::tspb_logo.png[]


== About

This project dockerize link:https://github.com/tsahbazoglu/fms[FMS^]


[#user-content-quick-start-with-docker]
== Quick Start with Docker

=== Operation System
----
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic
----

=== Install docker on ubuntu server 18.04
----
apt-get update
apt-get upgrade
apt-get install docker
apt-get install docker-compose

sudo apt install docker.io
sudo apt install docker-compose

sudo dockerd &

usermod -aG docker $USER
newgrp docker
docker run hello-world
----

run docker as non root:: 
----
groupadd docker
usermod -aG docker $USER
sudo gpasswd -a $USER docker
newgrp docker
docker run hello-world

chmod 755 -R .
reboot
----
== Instal git
----
apt-get install git
----

=== Build & Run
git clone::
----
mkdir github
cd github
git clone https://github.com/tsahbazoglu/fms-docker.git
cd fms-docker
----

replace required files::
----
cp ~/Downloads/payara-5.2020.3.zip                        ~/github/fms-docker/core-alpine
cp ~/Downloads/payara-5.2020.3.zip                        ~/github/fms-docker/core
cp ~/Downloads/fms-ear-1.0.0.ear                          ~/github/fms-docker/core
cp ~/Downloads/mongodb-linux-x86_64-ubuntu2004-4.4.3.tgz  ~/github/fms-docker/mongodb
----


cleanup::
----
docker container stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi --force $(docker images -q)
----

build&run::
----
nano tspb.sh
export COMPOSE_PROJECT_NAME=tspb
export OPENLDAP_ENV_BASE_DN=dc=tspb,dc=org,dc=tr
export OPENLDAP_ENV_BASE_DN_FOR_PAYARA="dc\=tspb,dc\=org,dc\=tr"
export OPENLDAP_ENV_DOMAIN=tspb.org.tr
export OPENLDAP_ENV_PSWD=12345678
export FMS_SUBNET=172.16.250.0
export FMS_LDAP_NET=172.16.250.2
export FMS_MONGO_NET=172.16.250.3
export FMS_CORE_NET=172.16.250.4
export FMS_CORE_ALPINE_NET=172.16.250.5
export FMS_MONGO_VERSION=3.2.3
----

----
source ~/tspb.sh
docker-compose up --build -d
----

or by setting COMPOSE_PROJECT_NAME environment variable as docker-copmose parameter like below

----
docker-compose -p tspb up --build -d
----

NOTE: project name will affect network and volume prefixes


stop&start::
----
cd ~/git/fms-docker
docker container stop $(docker ps -a -q)

docker-compose up -d
docker-compose start
----

=== Initialize
----
docker-compose exec core bash
./config.sh
./restart.sh

docker-compose exec openldap bash
./init.sh

docker-compose exec mongodb bash
./init.sh
----

=== Compile And Deploy
----
cd ~/github
git clone https://github.com/tsahbazoglu/fms.git
cd ~/github/fms

mvn clean install

docker cp ~/github/fms/fms-ear/target/fms-ear-1.0.0.ear fms-core:/home/fms

cd ~/github/fms-docker
docker-compose exec core ./deploy.sh
----

observe::
----
docker-compose ps
----

check inter connections::
----
docker-compose exec core ping mongodb
docker-compose exec core ping openldap
----

enjoy::
----
http://localhost:8080

username : admin

password : 123
----

== backup & restore

=== create backup
----
mkdir ~/fms_backup

docker run --rm \
--volumes-from fms-mongodb \
-v ~/fms_backup:/backup \
ubuntu \
bash -c "cd /home/fms/fmsdb && tar cvf /backup/fms-mongodb-fmsdb-volume.tar ."

docker run --rm \
--volumes-from fms-openldap \
-v ~/fms_backup:/backup \
ubuntu \
bash -c "cd /var/lib/ldap && tar cvf /backup/fms-openldap-data-volume.tar ."

----

check backup::
----
cd ~/fms_backup
ls -lrt 
----

=== restore

rectreate volumes::
----
docker volume ls

docker volume rm fms_mongodb-data
docker volume rm fms_openldap-data

docker volume create fms_mongodb-data
docker volume create fms_openldap-data
----

get backups::
----
mkdir ~/fms_backup

cd ~/fms_backup

scp username@fms_server_ip:/home/fms_backup/fms-mongodb-fmsdb-volume.tar ./

scp username@fms_server_ip:/home/fms_backup/fms-openldap-data-volume.tar ./
----

restore::
----
docker run --rm \
-v fms_mongodb-data:/recover \
-v ~/fms_backup:/backup \
ubuntu \
bash -c "cd /recover && tar xvf /backup/fms-mongodb-fmsdb-volume.tar"

docker run --rm \
-v fms_openldap-data:/recover \
-v ~/fms_backup:/backup \
ubuntu \
bash -c "cd /recover && tar xvf /backup/fms-openldap-data-volume.tar"
----

----
# docker run -d -v tdub_mongodb-data:/home/fms/fmsdb fms-mongodb
----


== Prepare Your First Project on FMS

In a production environment *link:https://git.tspb.org.tr/fms/fms/blob/master/quick-start-demo-config.js[quick-start-demo-config.js^]* should be replaced with one prepared by expirenced data&buisness analyst.

Please do not hesitate to contact with us to find data&buisness analyst having an expirence with FMS project.

There is also a *https://git.tspb.org.tr/fms/fms/blob/master/DEVELOPER-GUIDE-v1.adoc[developer guide^]* for the contributors who want to educate themselves as a data analyst for FMS project.

We can organize eductaion courses in our office for contributors and companies who want 
to join to our expert team.

We can also consult your team from the scratch to live and support during the your company's project life cycle.

----
cd  ~/git/fms-docker

docker ps  

docker cp quick-start-demo-config.js docker_mongodb_1:/home/tspb

docker exec -it docker_mongodb_1 bash

export MONGODB_HOME=~/Apps/mongodb-linux-x86_64-3.2.6
export PATH=$PATH:$MONGODB_HOME/bin

mongo configdb --quiet quick-start-demo-config.js
----