# How to bundle a SMILE application?

  1. To bundle the full application:

    [Lottery] $ smile clean; prepare; generate; compile;
    [Lottery] $ bundle
    ...
    info] release file created at : /Users/pallavi/training/lottery/release/lottery-lottery-0.1.zip
    
  2. To create a custom bundle:

    1. Define the bundle in ksmile with the modules that needs to be included. For example, to create a bundle with name lottery_read of only the projection related modules:

      bundle lottery_read(LotteryStream, LotteryQuery, LotteryReadMongo)
      
    2. run command bundle <bundle-name>

      [Lottery] $ bundle lottery_read
      ...
      [info] release file created at : /Users/pallavi/training/lottery/release/lottery-lottery_read-0.1.zip
      
    3. You can also create a bundle and include all the components as follows:

      bundle pack all 
      

      In this case the bundle will be created with name lottery-pack-0.1.zip

  3. To create an environment specific bundle:

    1. Inside the bundle folder within project-home/release, create a folder with the env name, for example: stage
    @$:~/training/lottery/release/lottery_read>mkdir stage
    
    1. copy the start & stop server scripts from the project-home/release/<bundle-name> folder.
    @$:~/training/lottery/release/lottery_read>cp *.sh stage/
    
    1. Update the scripts to include the env-name For example: edit start-server.sh as follows:
    nohup ./bin/lottery -Dsmile.env=stage -Dhttp.port=9000 -Dpidfile.path=play.pid & 
    

    Consider this folder as the placeholder for any env specific files that needs to go into the bundle.

    1. run command bundle <bundle-name> <env-name>
    [Lottery] $ bundle lottery_read stage
    ...
    [info] release file created at : /Users/pallavi/training/lottery/release/lottery-lottery_read-0.1.zip
    

Note: In all the above cases the bundle gets created inside project-home/release folder with a .zip extension.