---
# System prepended metadata

title: Waymark Template Studio Deploy Process

---

# Waymark Template Studio Deploy Process
### Deploy template from the Studio
1. In the Waymark Template Studio, enter the template you want to deploy and open up developer tools. Then, type, `window.PUBLISH_THIS_VERSION('my_template_slug')`. When this is done you'll see `PUBLISH SUCCEEDED`.
2. Your `bundle.json` is now uploaded to `https://waymark-template-studio-development.s3.amazonaws.com/temporary-published-bundles/${publishPublicId}`. The URL is in the returned console statement.
3. Create a directory in `https://sp-prod-s3-assets.s3.amazonaws.com/web/video_creatives` with your template slug and transfer everything in the temporary directory into it. **This has to be done before you run the deployment script.**

### Download your reference documents
1. All ref docs live [here](https://docs.google.com/spreadsheets/d/1PCTakJbMUnVbpMt-jXYy1WIc6oSOEHq7RzaS-zcLd8A/edit#gid=5196222) for the timebeing. If you can't find a tab for your template, ask Maggie where it is. [This](https://docs.google.com/document/d/1sKmSn7Lfu5vsuJ5fSeuB_CN5hBf_PCfYOTXJPBAFi7I/edit#) Google doc has some more details on the reference doc format.
2. Make sure your reference document is formatted correctly. Maggie has been onboarded and knows the format, but some of these documents were created before we knew the format. A few common things to check:
    - Make sure you have a template name in cell A1 and template slug in cell B1, e.g., `Recess` and `recess`.
    - Make sure all of your business tags (things surrounded in brackets, e.g., `[Business Name]`) should match a defined tag in the 'Business Info Mapping' tab.
    - Make sure that the content tags in the reference section match the content tags in the industry section. The script relies on these tags matching up.
3. Download your reference doc as a CSV file.

### Run deployment script
1. The most up to date script has not been merged into development yet (sorry), so you'll have to use this annoying workaround. Checkout to `story/WP-492-parse-search-content`. From here, and this is how I've deployed all of the templates thus far, create a scratch branch based on this branch where you'll run the deploy script.
2. Run this command: `./manage.py create_template_deployment --slug=<the template slug> --csv-file=<the exported CSV file> [--overwrite]`.
3. The script creates four files:
    - search constants
    - data migration
    - data migration json
    - a deploy log
4. You do not need to commit the deploy log, I've been saving all of mine in a folder on my local machine.
5. Stash the new files, check out to the branch you actually want to deploy with, and then pop that stash baby! 


### Make quick updates in Ivory
7. The script takes you about 90% of the way, but you'll need to make a few quick updates:
    - search constants (`/video_creatives/video_template_constants/${templateSlug}.py`)
        - ALMOST NOTHING!
        - Except this one thing that I'm very upset about - any variable names or formatted strings in the industry default section have extra quotes around them. Here's what I'm talking about, this:
        ```
        INDUSTRY_DEFAULT_CONTENT = {
            "active-life": {
                 'text--234098450825': "BUSINESS_NAME_TEMPLATE_UPPER"
                 'text--123409845082': "\"The best restaurant in {}\".format(BUSINESS_CITY_TEMPLATE)"
            }
        }
        ```
        - should be this:
        ```
        INDUSTRY_DEFAULT_CONTENT = {
            "active-life": {
                 'text--234098450825': BUSINESS_NAME_TEMPLATE_UPPER
                 'text--123409845082': "The best restaurant in {}".format(BUSINESS_CITY_TEMPLATE)
            }
        }
        ```
    - Lastly, you'll need to import your template constants in `video_creatives/video_template_constants/__init__.py` and `/Users/samanthastewart/Waymark/repos/ivory/web/video_creatives/models/video_template_variant.py`. In `video_template_variant.py` you will also need to add your template slug and constants to the `VIDEO_TEMPLATE_CONSTANTS_BY_SLUG` object.
    - data migration
        - File is currently named `XXXX_add_${templateSlug}_template.py`. Replace `XXXX` with the next migration number.
        - At the bottom of your migration file, there is a `dependencies` array. The first item in that array is this tuple, `('video_creatives', '')`. In the empty string, add the name of the migration that was created before this one. 
8. Add your template to the `VIDEO_TEMPLATE_METADATA_BY_SLUG` object in `ivory/web_video_rendering/src/video_render_coordinator.js`. Just copy and paste this code block with your template slug: 
```
{template_slug}: {
    backgroundAudio: (configuration) => parseAsset(configuration.backgroundAudio).path,
    thumbnailFrame: 100,
    totalFrames: 900,
    width: 1920,
    height: 1080,
    renderFormat: 'broadcast_quality',
  },
 ```
9. Add your template slug to the `waymarkAuthorTemplates` array in `/client/shared/web_video/utils/WaymarkAuthorBundleManager.js`.
10. Run `manage.py migrate` to add your template to the database, and now you should be able to load your template up to test at `localhost:8000/videos/${templateSlug}.default/edit`.

