Domain Driven Architecture

2. März 2018 By: Lukas Schondorff

dda-pallet series: 4-Execute Pallet locally

The goal of this blog is to provide you with a full fledged development environment. The configuration provided by the dda-managed-ide crate enables you to adjust the setup to your liking. In order to achieve this, we are utilizing dda-pallet to describe the infrastructure as clojure code. This blog is part of the "dda-pallet" series and will guide you step by step through the setup to a fully functional clojure IDE.

  1. Provision existing Targets
  2. Compose crates
  3. Convention over Configuration with Domain Driven Design
  4. Execute Pallet locally
  5. Plugin Operational Services
  6. Test-driven DevOps

In the previous blog, we installed the dda-managed-vm. This time we will install the dda-managed-ide (ide). This crate builds on top of the dda-managed-vm and additionally provides an integrated development environment (ide). Furthermore, all software and tools that are installed by the dda-managed-vm are also installed by the dda-managed-ide.

  1. Configured credentials: We will configure the user to be installed with our credentials. (Definitions of gpg- or ssh-keys are optional, so that you will not be forced to expose your credentials to an unsafe target system):
    • user name,
    • password,
    • ssh-key and
    • gpg keys
  2. configured bookmarks
  3. integrated development environments (pre-configured with useful plugins e.g. for clojure development)

As a result, we should be able to log in to our virtual machine and be able to do various tasks like browsing the internet, use LibreOffice, password-store, GPG and many more.

The main goal of the dda-managed-ide is to provide a functional development environment and thus, the Atom text editor with different useful plugins alongside python is installed.

Preconditions

We have the similar preconditions as last time. We will start from a clean virtual machine having xubuntu 16.4.2LTS installed. You can find a more detailed description on how to create a vm in the first post of this series.

In addition we will need java to be installed:

sudo apt-get install openjdk-8-jre
 

Get the standalone jar

We provide an all in one jar file which is executable. You can get this jar file from github releases. Or you can directly use wget:

wget  https://github.com/DomainDrivenArchitecture/dda-managed-ide/releases/download/1.0.1/dda-managed-ide-1.0.1-standalone.jar
 

Configuration of your IDE

The next step is to adjust your desired configuration. Create a file called for example ide.edn with following contents:

{:vm-type :desktop
 :dev-platform :clojure-atom
 :user {:name "test-user"
        :password {:plain "xxx"}
        :email "test-user@mydomain.org"
        :ssh {:ssh-public-key {:plain "rsa-ssh kfjri5r8irohgn...test.key comment"}
              :ssh-private-key {:plain "Test123"}}
        :gpg {:gpg-public-key
              {:plain "-----BEGIN PGP PUBLIC KEY BLOCK-----
a public gnupg key
...."}
              :gpg-private-key
              {:plain "-----BEGIN PGP PRIVATE KEY BLOCK-----
a private gnupg key
...."}
              :gpg-passphrase {:plain "passphrase"}}}}

Your options are

  • :vm-type may be :desktop (installs virtualbox-guest-utils) or :remote (installs & configures tightvnc).
  • :dev-platform may be :clojure-atom (atom + clojure plugins) or :clojure-nightlight (nightlight ide setup).
  • :user describes your user on operating system level, if dda-pallet should create & configure your user account.
  • The :ssh and :gpg keys are optional. But if you use them, the credentials should be fairly valid. If you're just want to use some snakeoil, take ours here.All credentials in our example are described :plain as the most simple data source. In more advanced configurations you can also use more secure data sources.

Provision your Virtual Machine

Now it's time to bring our configuration to our virtual machine. Because dda-pallet installs some of the software via the package-manager, you need to execute the commands with root privileges.

Start a terminal at the location of your jar-file. Lets assume, you placed your configuration in same folder and named it ide.edn so you can now execute:

sudo java -jar dda-managed-ide-1.0.1-standalone.jar ide.edn
 
In case of success, your Terminal will finally show:

Use your newly provisioned IDE

After you installed the IDE, you can log in with your newly created user. In our case, that would be test-user with xxx as password.

When you inspect your machine, you can find all the things we installed. When u navigate to ~/.ssh for example, you can see your ssh-keys.

When you typ atom in your terminal or search it in your explorer, you will find the installed atom. Use Edit/Preferences/Packages to find a bunch of useful plugins already installed like git-plus or proto-repl.

If you already want to start programming in clojure, we also provide all our git-repositories under /home/test-user/repo/dda-pallet. For example you can open the source-code of the IDE and try to understand it or you can programm your own dda-pallet crate and test it with your proto-repl.

Special target localhost

When you start the jar file without any config files, you see that you could also add a target.edn. It would look something like this:

sudo java -jar dda-managed-ide-1.0.1-standalone.jar -t target.edn ide.edn
 
A target config could look something like that:
{:existing [{:node-name "test-ide1"           ; semantic name
             :node-ip "35.157.19.218"}]       ; the ip4 address of the machine to be provisioned
 :provisioning-user {:login "initial"         ; account used to provision
                     :password "secure1234"}}
 
The localhost installation is just a variation of the config seen above. The most obvious thing is, that you change the node-ip to 127.0.0.1. The secound thing is that you can omit the provisioning-user. Thats because you will run localhost installation using your current user. If you follow these steps, your configuration will look like :
{:existing [{:node-name "test-ide1"
             :node-ip "127.0.0.1"}]}
 
You can use localhost tartget with every dda-pallet crate. Application to localhost works without ssh so in this case ssh-server has not to be installed.


Tags: Execute Pallet locally dda-managed-ide howto clojure ide composition dda-pallet phases

Powered by Cryogen | Free Website Template by Download Website Templates | Datenschutzerklärung | Impressum