<commit_before>#+TITLE:     Deploying Clojure Applications

* Introduction
  
  Applications can be deployed to Immutant as a directory on disk, or
  as an archive. The actual deployment process can be done manually or
  using the =lein-immutant= Leiningen plugin. See the [[./installation.html][Installation]]
  chapter for details on how to install the plugin.

* Manually Deploying Artifacts

  To manually deploy any artifact to Immutant, you follow the standard AS7 deployment
  method. Deploying consists of creating two files in =$JBOSS_HOME/standalone/deployments/=:
  the artifact itself, and a marker file that tells Immutant that you have
  finished creating the artifact. This marker file has the same name as the artifact, but
  with the =.dodeploy= suffix appended, and has no content. Example:

  #+begin_src sh
      $ cp thing-to-deploy $JBOSS_HOME/standalone/deployments/
      $ touch thing-to-deploy.dodeploy $JBOSS_HOME/standalone/deployments/
  #+end_src

  Luckily, you should rarely need to manually deploy your artifacts - the plugin 
  takes care of that for you.

* Directory-based Deployment
  :PROPERTIES:
  :CUSTOM_ID: deployment-directory
  :END:

  To deploy an application from where it sits on disk (in other words, without having
  to create an archive), simply call the =deploy= subtask of the plugin. The =deploy= 
  subtask optionally accepts the path to the project. If no path  is specified,
  the current working directory is assumed:

  #+begin_src sh
      $ lein immutant deploy
      # or
      $ lein immutant deploy path/to/project
  #+end_src

  This generates and deploys a /deployment descriptor/ that refers to the location
  of the application on disk. See the [[#deployment-descriptor][descriptor]] section below for more details.

  The =lein-immutant= plugin provides additional deploy options - see [[https://github.com/immutant/lein-immutant#lein-immutant-][its README]]
  for details.

* Archive-based Deployment
  :PROPERTIES:
  :CUSTOM_ID: deployment-archive
  :END:

  Immutant supports deployment of archives that have been generated by the
  =lein-immutant= plugin. An Immutant archive is simply a zip file with a
  specific format that ends with a =.ima= suffix. Currently, the only supported
  way to generate an Immutant archive is via the plugin. The =archive= subtask
  optionally accepts the path to the project. If no path is specified, the 
  current working directory is assumed. In either case, the =.ima= is written to the 
  current working directory. Example usage:

  #+begin_src sh
      $ lein immutant archive
      # or
      $ lein immutant archive path/to/project
  #+end_src

  The archive can optionally contain the application's
  dependencies. They are excluded by default, but will be included if
  the =--include-dependencies= option is passed to the =archive= subtask.

  The =archive= subtask creates the archive using the following process:
  
  1. If dependencies are to be included, they are resolved into the
     local maven repository
  2. Those resolved dependencies are copied to =lib/= at the root of
     the project
  3. The =lib/= dir is zipped up along with the =src/=, =resources/=,
     =target/native=, =classes=, and =target/classes= dirs, as well as
     the =project.clj=.

  The archive process honors the =:source-paths=, =:resources-paths=,
  =:native-path=, and =:compile-path= options of =project.clj=, allowing you to 
  override the default directories.

  Calling the =archive= subtask directly gives you an =.ima= that you can then
  manually deploy. To deploy an archive via the plugin, simply pass the =--archive=
  option to the =deploy= subtask. The =deploy= subtask optionally accepts the path
  to the project. If no path is specified, the 
  current working directory is assumed:

  #+begin_src sh<commit_msg>Update docs to mention that deps are now included by default by the plugin.<commit_after>#+TITLE:     Deploying Clojure Applications

* Introduction
  
  Applications can be deployed to Immutant as a directory on disk, or
  as an archive. The actual deployment process can be done manually or
  using the =lein-immutant= Leiningen plugin. See the [[./installation.html][Installation]]
  chapter for details on how to install the plugin.

* Manually Deploying Artifacts

  To manually deploy any artifact to Immutant, you follow the standard AS7 deployment
  method. Deploying consists of creating two files in =$JBOSS_HOME/standalone/deployments/=:
  the artifact itself, and a marker file that tells Immutant that you have
  finished creating the artifact. This marker file has the same name as the artifact, but
  with the =.dodeploy= suffix appended, and has no content. Example:

  #+begin_src sh
      $ cp thing-to-deploy $JBOSS_HOME/standalone/deployments/
      $ touch thing-to-deploy.dodeploy $JBOSS_HOME/standalone/deployments/
  #+end_src

  Luckily, you should rarely need to manually deploy your artifacts - the plugin 
  takes care of that for you.

* Directory-based Deployment
  :PROPERTIES:
  :CUSTOM_ID: deployment-directory
  :END:

  To deploy an application from where it sits on disk (in other words, without having
  to create an archive), simply call the =deploy= subtask of the plugin. The =deploy= 
  subtask optionally accepts the path to the project. If no path  is specified,
  the current working directory is assumed:

  #+begin_src sh
      $ lein immutant deploy
      # or
      $ lein immutant deploy path/to/project
  #+end_src

  This generates and deploys a /deployment descriptor/ that refers to the location
  of the application on disk. See the [[#deployment-descriptor][descriptor]] section below for more details.

  The =lein-immutant= plugin provides additional deploy options - see [[https://github.com/immutant/lein-immutant#lein-immutant-][its README]]
  for details.

* Archive-based Deployment
  :PROPERTIES:
  :CUSTOM_ID: deployment-archive
  :END:

  Immutant supports deployment of archives that have been generated by the
  =lein-immutant= plugin. An Immutant archive is simply a zip file with a
  specific format that ends with a =.ima= suffix. Currently, the only supported
  way to generate an Immutant archive is via the plugin. The =archive= subtask
  optionally accepts the path to the project. If no path is specified, the 
  current working directory is assumed. In either case, the =.ima= is written to the 
  current working directory. Example usage:

  #+begin_src sh
      $ lein immutant archive
      # or
      $ lein immutant archive path/to/project
  #+end_src

  The archive can optionally contain the application's
  dependencies. They are included by default, but will be excluded if
  the =--exclude-dependencies= option is passed to the =archive= subtask.

  The =archive= subtask creates the archive using the following process:
  
  - If dependencies are to be included, they are resolved into the
    local maven repository, and then included in the zip archive
    under =lib/=.
  - From the project root, the =src/=, =resources/=, =target/native/=,
    =classes/=, =target/classes/=, and =lib/= dirs are included in the
    zip, as well as the =project.clj=.

  The archive process honors the =:source-paths=, =:resources-paths=,
  =:native-path=, and =:compile-path= options of =project.clj=, allowing you to 
  override the default directories.

  Calling the =archive= subtask directly gives you an =.ima= that you can then
  manually deploy. To deploy an archive via the plugin, simply pass the =--archive=
  option to the =deploy= subtask. The =deploy= subtask optionally accepts the path
  to the project. If no path is specified, the 
  current working directory is assumed:

  #+begin_src sh
{'fraction_non_alphanumeric': 0.06778123379989633, 'fraction_numerical': 0.0006480041472265422, 'mean_word_length': 3.7314530962599632, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2459203', 'n_tokens_mistral': 2237, 'n_tokens_neox': 2121, 'n_words': 1001}