|
| 1 | +--- |
| 2 | +slug: installing-production-app |
| 3 | +title: Installing a docassemble app on your production server |
| 4 | +sidebar_label: Installing a docassemble app on your production server |
| 5 | +--- |
| 6 | + |
| 7 | +Installing your app involves three basic steps: |
| 8 | + |
| 9 | +1. [Putting the app into a |
| 10 | + package.](https://docassemble.org/docs/packages.html#playground). It's best |
| 11 | + to store the package on Github. |
| 12 | +2. Installing the app system-wide. |
| 13 | +3. Creating a shortcut `alias` to the app so that you can view it on the |
| 14 | + "Available interviews" /list menu and run it via /start/`alias`. |
| 15 | + |
| 16 | +## Quick start |
| 17 | + |
| 18 | +Before installing the package, you will need: |
| 19 | + |
| 20 | +1. The URL to the package on GitHub. |
| 21 | +1. The name of the interview YAML file. |
| 22 | +1. The desired "alias" or shortcut name for the package. |
| 23 | + |
| 24 | +**The interview author should be able to provide all three pieces of information |
| 25 | +to the server administrator before asking for the app to be installed.** |
| 26 | + |
| 27 | +## Installing the app system-wide |
| 28 | + |
| 29 | +To install a package, visit the "Package Management" page on your docassemble |
| 30 | + server (you can reach it via Menu | Package Management, or the /updatepackage |
| 31 | + page on your server. |
| 32 | +) |
| 33 | + |
| 34 | +Copy the Github link to your package into the "Github URL" input. It should look |
| 35 | +something like this: `https://github.com/gbls/docassemble-MAEvictionDefense` |
| 36 | +(without any trailing `/`). |
| 37 | + |
| 38 | +Now, scroll down and click on the large "Update" button. Although this is marked |
| 39 | +"Update," it also serves to install a package for the first time. |
| 40 | + |
| 41 | +## Running the installed package |
| 42 | + |
| 43 | +Now that you've installed the package, how do you run it? You will need to |
| 44 | +identify two things: |
| 45 | + |
| 46 | +1. The internal/Python name of the package that corresponds to your package from |
| 47 | + GitHub. |
| 48 | +1. The name of the YAML file(s) that contains the runnable logic of the package. |
| 49 | + |
| 50 | +The internal name of the package is very similar to the name of the GitHub |
| 51 | +repository, except that you replace the `-` with a `.`. For example, the package |
| 52 | +https://github.com/gbls/docassemble-MAEvictionDefense becomes |
| 53 | +`docassemble.MAEvictionDefense`. Package names are case sensitive. If you used |
| 54 | +the docassemble playground to create your package, it will always start with |
| 55 | +"docassemble" as the beginning of the package name. |
| 56 | + |
| 57 | +The YAML file name is simply the name that the file has in your playground. |
| 58 | +If this is someone else's package, you will need to do a small amount of dective |
| 59 | +work. |
| 60 | + |
| 61 | +Visit the GitHub page for the package. Each docassemble package has the same |
| 62 | +folder structure. Navigate by clicking through the folders as follows, replacing |
| 63 | +"PackageName" with the name of your package. |
| 64 | + |
| 65 | +``` |
| 66 | +docassemble |
| 67 | + +---[PackageName] |
| 68 | + +----data |
| 69 | + +---questions |
| 70 | +``` |
| 71 | + |
| 72 | +For example, for the MAEvictionDefense package, the folder contents |
| 73 | +look like this: |
| 74 | +https://github.com/GBLS/docassemble-MAEvictionDefense/tree/master/docassemble/MAEvictionDefense/data/questions |
| 75 | + |
| 76 | +For some packages, there is only one YAML file. If there is more than one, you |
| 77 | +can either ask the package author which one should be run, or click through a |
| 78 | +few and pick the likeliest candidate. For the MAEvictionDefense package, the |
| 79 | +main interview file is named "eviction.yml". |
| 80 | + |
| 81 | +For a package named `docassemble.MAEvictionDefense` and a YAML file named |
| 82 | +`eviction.yml`, the link to run the interview is |
| 83 | +`https://[docassemble.example.com]/run/MAEvictionDefense/eviction`. |
| 84 | + |
| 85 | +## Creating a permanent shortcut link to the package |
| 86 | + |
| 87 | +If you want, you can add a [customizable, short |
| 88 | +alias](https://docassemble.org/docs/config.html#dispatch) for the interview. |
| 89 | + |
| 90 | +This adds the interview to the /list URL on the server, the "Available |
| 91 | +interviews" menu option, and allows you to advertise a nicer URL, like |
| 92 | +`https://docassemble.example.com/start/alias`. |
| 93 | + |
| 94 | +This gives you a lot of flexibility to repackage your app later, which |
| 95 | +makes it a good idea if you ever want to share the link on a different |
| 96 | +website. |
| 97 | + |
| 98 | +You will use the same information needed above: the **package name** |
| 99 | +and the **YAML filename**. |
| 100 | + |
| 101 | +Visit the docassemble configuration page (/config) on your server. |
| 102 | + |
| 103 | +Scroll down and look for an existing `dispatch` section in your |
| 104 | +configuration file. If you don't see one, create a new one that looks |
| 105 | +like this: |
| 106 | + |
| 107 | +``` |
| 108 | +dispatch: |
| 109 | + alias: docassemble.MyPackageName:data/questions/interview_name.yml |
| 110 | +``` |
| 111 | + |
| 112 | +Replace "MyPackageName" and "interview_name.yml" with the package name |
| 113 | +and the YAML filename for your package, respectively. Now, when someone |
| 114 | +visits "https://docassemble.example.com/start/alias" they will be redirected to the |
| 115 | +"interview_name.yml" interview. |
| 116 | + |
| 117 | +For example, for the MAEvictionDefense package, the configuration looks like |
| 118 | +this: |
| 119 | + |
| 120 | +``` |
| 121 | +dispatch: |
| 122 | + eviction: docassemble.MAEvictionDefense:data/questions/eviction.yml |
| 123 | +``` |
| 124 | + |
| 125 | +And the interview can be run via `https://interviews.gbls.org/start/eviction`. |
| 126 | + |
| 127 | +## Updating an app that is already installed |
| 128 | + |
| 129 | +If the app has already been installed on the server, you do not need to get the |
| 130 | +GitHub URL again. Just scroll down the /updatepackage page until you see the |
| 131 | +name of the package (remember, it will be docassemble.PackageName). Then click the |
| 132 | +"update" button next to the package. |
| 133 | + |
| 134 | +If you do not see the "update" button but the package is listed, then use the |
| 135 | +GitHub URL as described above. |
0 commit comments