Deploying DynFi in less than 10 minutes!

Deploying DynFi in less than 10 minutes!

This blog post will show you how to get DynFi® running on Ubuntu Server 16.0.4 LTS in less than ten minutes !

You will need to have a basic knowledge of Linux / FreeBSD operating system and CLI (command line interface) and that should do the trick !

In order to go very fast, you can simply copy / paste the highlighted text to your favourite KVM with Linux Ubuntu 16 installed !

 

1.1. First install Java-JRE-8

We have followed the classic instlall described here : https://doc.ubuntu-fr.org/openjdk

root@dynfi:~# apt install openjdk-8-jre
[…]
Setting up openjdk-8-jre:amd64 (8u151-b12-0ubuntu0.16.04.2) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for ca-certificates (20170717~16.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
done. 

1.2. Second MongoDB 3.4

Get MongoDB installed : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

1.2.1. Download the gpg key of the repo:

root@dynfi:~# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
Executing: /tmp/tmp.3RE24n9pSg/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

 

1.2.2. Create a list file for MongoDB:

root@dynfi:~# echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse

 

1.2.3. Reload local package database:

root@dynfi:~# apt-get update
Hit:1 http://br.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://br.archive.ubuntu.com/ubuntu xenial-updates InRelease             
[…]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [75,1 kB]
Fetched 367 kB in 1s (290 kB/s)              
Reading package lists... Done

 

1.2.4. Install the MongoDB packages:

root@dynfi:~# apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 66,9 MB of archives.
[…]
Done.
Setting up mongodb-org-mongos (3.4.10) ...
Setting up mongodb-org-tools (3.4.10) ...
Setting up mongodb-org (3.4.10) ...

 

1.2.5. Start MongoDB

root@ccm-dc-dynfi:~# service mongod start

 

1.2.6. Verify that MongoDB has started successfully:

 

root@dynfi:~# cat /var/log/mongodb/mongod.log
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] MongoDB starting : pid=17314 port=27017 dbpath=/var/lib/mongodb 64-bit host=ccm-dc-dynfi
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] db version v3.4.10
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] allocator: tcmalloc
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] modules: none
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten] build environment:
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-11-08T13:01:28.651-0200 I CONTROL  [initandlisten]     target_arch: x86_64
[…]
2017-11-08T13:01:28.913-0200 I INDEX    [initandlisten]      building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2017-11-08T13:01:28.915-0200 I INDEX    [initandlisten] build index done.  scanned 0 total records. 0 secs
2017-11-08T13:01:28.915-0200 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.4
2017-11-08T13:01:28.915-0200 I NETWORK  [thread1] waiting for connections on port 27017@

 

1.2.7. Restart MongoDB:

This is optional - and just for verificaition purposes (can be skipped).

root@dynfi:~# service mongod restart
root@dynfi:~# systemctl status mongod
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: 
Active: active (running) since Qua 2017-11-08 13:04:22 BRST; 12s ago
Docs: https://docs.mongodb.org/manual
Main PID: 17341 (mongod)
CGroup: /system.slice/mongod.service
└─17341 /usr/bin/mongod --config /etc/mongod.conf

Nov 08 13:04:22 dynfi systemd[1]: Started High-performance, schema-free d@

 

1.2.8. Enable MongoDB at boot:

If you plan to keep DynFi installed on this server (and we hope you do !), you'll want to have the MongoDB auto-start upon boot !

 
root@dynfi:~# systemctl enable mongod.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /lib/systemd/system/mongod.service.@

 

2. Finally install DynFi:

2.1. Download gpg key

This key is needed in order to access our apt repository

root@dynfi:~# wget https://archive.dynfi.com/dynfi.gpg
--2017-11-08 20:03:09--  https://archive.dynfi.com/dynfi.gpg
Resolving archive.dynfi.com (archive.dynfi.com)... 188.165.99.5
Connecting to archive.dynfi.com (archive.dynfi.com)|188.165.99.5|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1181 (1,2K) [application/octet-stream]
Saving to: ‘dynfi.gpg’

dynfi.gpg                               100%[=============================================================================>]   1,15K  --.-KB/s    in 0s      

2017-11-08 20:03:10 (155 MB/s) - ‘dynfi.gpg’ saved [1181/1181]

 

2.2. Adding gpg key locally.

root@dynfi:~# apt-key add dynfi.gpg
OK

 

2.3. Adding DynFi repository to sources.list

root@dynfi:~# echo "deb https://archive.dynfi.com/ubuntu xenial main" > /etc/apt/sources.list.d/dynfi.list

 

2.4. Update your repository with DynFi sources:

 
root@dynfi:~# apt update
Hit:1 http://br.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://br.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://br.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]                                   
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]                                      
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease                                                      
Hit:6 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release                                                        
Get:7 http://br.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [652 kB]                                
Get:8 http://br.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [617 kB]                                          
Get:10 http://br.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [273 kB]                                                                
Get:11 http://br.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [308 kB]                                                     
Get:12 http://br.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [213 kB]                                                          
Get:13 http://br.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [544 kB]                                                    
Get:14 http://br.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [517 kB]                                           
Get:15 http://br.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [221 kB]               
Get:16 http://br.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [174 kB]                 
Get:17 http://br.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [245 kB]                      
Get:18 http://archive.dynfi.com/ubuntu xenial InRelease [4.892 B]                                              
[…]           
Fetched 4.350 kB in 1s (2.743 kB/s)                    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
7 packages can be upgraded. Run 'apt list --upgradable' to see them.

 

2.5. Install DynFi:

root@dynfi:~# apt install dynfi
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  dynfi
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 40,4 MB of archives.
After this operation, 44,3 MB of additional disk space will be used.
Get:1 http://archive.dynfi.com/ubuntu xenial/main amd64 dynfi all 17.2.1 [40,4 MB]
Fetched 40,4 MB in 41s (982 kB/s)                                                                                                                            
Preconfiguring packages ...
Skipping preconfiguration
Selecting previously unselected package dynfi.
(Reading database ... 249529 files and directories currently installed.)
Preparing to unpack .../archives/dynfi_17.2.1_all.deb ...
Unpacking dynfi (17.2.1) ...
Setting up dynfi (17.2.1) ...
Configuring DynFi
Config file not found
Created symlink from /etc/systemd/system/multi-user.target.wants/dynfi.service to /lib/systemd/system/dynfi.service.

 

Check that DynFi is correctly enabled:

root@dynfi:~# systemctl status dynfi
● dynfi.service - DynFi Service
   Loaded: loaded (/lib/systemd/system/dynfi.service; enabled; vendor preset: enabled)
   Active: active (running) since Qua 2017-11-08 20:47:18 BRST; 1min 56s ago
  Process: 22681 ExecStartPre=/bin/chown -R nobody:nogroup /run/dynfi/ (code=exited, status=0/SUCCESS)
  Process: 22678 ExecStartPre=/bin/mkdir /run/dynfi (code=exited, status=0/SUCCESS)
 Main PID: 22684 (java)
   CGroup: /system.slice/dynfi.service
           └─22684 java -jar /usr/share/dynfi/lib/dynfi-17.2.1-all.jar --pid-file=/run/dynfi/dynfi.pid

Nov 08 20:47:26 dynfi dynfi[22684]: INFO: LoggerImplFactory set to org.mongodb.morphia.logging.jdk.JDKLoggerFactory
Nov 08 20:47:27 dynfi dynfi[22684]: Nov 08, 2017 8:47:27 PM org.mongodb.morphia.mapping.MappedField discoverType
Nov 08 20:47:27 dynfi dynfi[22684]: WARNING: Parameterized types are treated as untyped Objects. See field 'params' on class com.dynfi.storage.entities
Nov 08 20:47:30 dynfi dynfi[22684]: Nov 08, 2017 8:47:30 PM org.glassfish.grizzly.http.server.NetworkListener start
Nov 08 20:47:30 dynfi dynfi[22684]: INFO: Started listener bound to [localhost:9090]
Nov 08 20:47:30 dynfi dynfi[22684]: Nov 08, 2017 8:47:30 PM org.glassfish.grizzly.http.server.HttpServer start
Nov 08 20:47:30 dynfi dynfi[22684]: INFO: [HttpServer] Started.
Nov 08 20:47:30 dynfi dynfi[22684]: Press Ctrl + C to quit the server
Nov 08 20:47:30 dynfi dynfi[22684]: Running with PID 22684
Nov 08 20:47:30 dynfi dynfi[22684]: The URL is: https://localhost:9090

 

Add DynFi as a startus service :

root@dynfi:~# systemctl enable dynfi

 

Do some final tuning in the config file /etc/dynfi.conf :

  • Changing the IP of the host
  • verifying ports
  • … 

 

Restart service once done and you should now be up and running !

root@dynfi:~# systemctl restart dynfi

You should now be able to access your DynFi service using your favourite (and up to date !) browser.

Default port is 9090 (unless you have updated It on the config file), so URL should look something like : https://my.dynfi.srv:9090

 

About the Author

Connexion utilisateur