Domain Driven Architecture

July 7, 2017 By: Michael Jerger

dda-pallet series: 1-Provision existing Targets

Do you know the pain arriving as new software developer in a existing project? How long does it take, till all used tools are working on your computer, how long till you've collected all important urls and credentials? Wouldn't it be nice, to get a proper set up development environment straight away from beginning - but also be able to adjust your setup as you like it?

Therefore 'Infrastructure as Code' sounds like good idea. Let's find out, how you can achieve this using dda-pallet.

The "dda-pallet" series will show step by step how to setup a clojure ide and introduce to important dda-pallet topics. The series covers

  1. Provision existing Targets: Applying your first dda-pallet crate (crate is pallets term for module, see pallets glossary) to an existing virtual machine. The dda-user-crate will bring your defined user to your ide.
  2. Compose crates: We will add some git repositories to your ide by composing the dda-git-crate.
  3. Convention over Configuration: We will learn, how the ideas of Domain Driven Desing fits into the world of DevOps - an indeed, we will install a bunch of desktops basic software adding the dda-managed-vm crate.
  4. Execute Pallet local: By expanding our virtual machine for development specific stuff (dda-managed-ide) we will learn how we can apply pallet on a local system without need of networking or ssh.
  5. Plugin Operational Services: We will add backup to our ide and see, how we can add operational services by just adding a module (dda-backup-crate).
  6. TestDriven DevOps: Finally we will introduce a remote-whitebox-test in order to get confidence with dda-serverspec-crate.

Preconditions

But lets begin with the first steps, lets have a view on our preconditions:

  1. A virtual machine having xubuntu 16.4.2LTS installed (we use virtualbox, 64-bit, 1 core, 2GB Ram, hdd starting from 50GB, two network interfaces: nat & hostonly) - just for example, you're not bound to our setup)
  2. during setup remember the given user credentials for the provisioning process (lets assume, we choose login "initial" and pssword "secure1234")
  3. install a ssh-server, so we will be able to do provisioning by ssh:
    sudo apt-get install openssh-server
    

Configure your first dda-pallet crate

For getting first insight, we will provision a user "user-name" to the target system:

  1. Clone dda-user-crate repository from GitHub
    git clone -b dda-user-crate-0.5.2 https://github.com/DomainDrivenArchitecture/dda-user-crate.git
    
  2. Open "instantiate_existing.clj"
    loacted in: integration/dda/pallet/dda_user_crate/app/instantiate_existing.clj
    
  3. Adjust your target ip (if we type ifconfig in virtual machine we will find our IP - 192.168.56.104 in our case)
    (def provisioning-ip "192.168.56.104")
    
  4. Fill in your provision user credentials (if you've choosen on vm-setup the same credentials as we did, go with initial - secure1234. If not, replace with yours)
    (def provisioning-user
     {:login "initial"
      :password "secure1234"})
    
  5. Adjust the desired user configuration
    1. user name: You can change the :user-name in oder to change users name
    2. encrypted-password: You can create your encrypted password by using
      mkpasswd your_password
      
      on any linux system
    3. authorized-keys: Your users public ssh key will be read from your local user home. So your configuration may look like:
      (def user-config
       {:user-name {:encrypted-password  "xxx"
        :authorized-keys [ssh-pub-key]}})
      

Provision your Virtual Machine

  1. Start your REPL & switch to instantiate-existing namespace
    (use 'dda.pallet.dda-user-crate.app.instantiate-existing)
    
  2. Start provisioning
    (apply-install)
    
    your REPL should look somewhat as follows: In case of success, your REPL will show:
  3. Sucessfully we finished provisioning. So let's test the newly provisioned user. We should be able to connect ssh:
     ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user-name@192.168.56.104
    
  4. Inspect Logfiles: If the worst comes to the worst it my be a good idea to know, where logfiles are configured and stored. You will find the configuration in
    dev-resources/logback.xml
    
    And logfiles are stored below your REPLs execution location in
    ./logs/pallet.log
    

Tags: howto first-steps clojure ide dda-user-crate dda-pallet provision existing target

Powered by Cryogen | Free Website Template by Download Website Templates | Impressum