|
| 1 | +# Web Portal using Docker |
| 2 | + |
| 3 | +We are managing our Web Portal instances using a Docker image on EC2. |
| 4 | + |
| 5 | +## Deployment |
| 6 | + |
| 7 | +You can connect using the `ubuntu` user to the EC2 instance. In the instance, there is a `docker-compose.yml` file. |
| 8 | + |
| 9 | +This file sets up a Web Portal service that runs on a single container with the following key components: |
| 10 | + |
| 11 | +### What it does: |
| 12 | +- Runs a web portal application in a Docker container named "webportal" |
| 13 | +- Serves web traffic on both HTTP (port 80) and HTTPS (port 443) |
| 14 | +- Manages multiple client portals for different organizations/museums |
| 15 | + |
| 16 | +### Key features: |
| 17 | +- SSL/HTTPS support with Let's Encrypt certificates |
| 18 | +- Custom configurations for different client portals |
| 19 | +- File exports from Specify databases stored as ZIP files |
| 20 | +- Custom branding with client-specific images and settings |
| 21 | +- Auto-restart if the container fails |
| 22 | + |
| 23 | +### Volume mounts: |
| 24 | +The container connects several directories from the host machine (under `/home/ubuntu/`): |
| 25 | + |
| 26 | +- **Project files** - the main web portal application code |
| 27 | +- **SSL certificates** - for HTTPS encryption |
| 28 | +- **Client exports** - database exports for each portal (ZIP files) |
| 29 | +- **Custom settings** - portal-specific configurations |
| 30 | +- **Custom images** - client branding and logos |
| 31 | + |
| 32 | +These should **not** be edited from within the container. |
| 33 | + |
| 34 | +```yml |
| 35 | +services: |
| 36 | + webportal: |
| 37 | + build: |
| 38 | + context: . |
| 39 | + dockerfile: Dockerfile |
| 40 | + image: webportal-service:improve-build |
| 41 | + container_name: webportal |
| 42 | + ports: |
| 43 | + - "80:80" |
| 44 | + - "443:443" |
| 45 | + volumes: |
| 46 | + # Project files |
| 47 | + - ./webportal-installer:/home/specify/webportal-installer |
| 48 | + |
| 49 | + # SSL and certs |
| 50 | + - /etc/letsencrypt/live/webportal.specifycloud.org:/etc/nginx/ssl |
| 51 | + - /etc/letsencrypt:/etc/letsencrypt |
| 52 | + - /etc/ssl/certs/dhparam.pem:/etc/ssl/certs/dhparam.pem |
| 53 | + |
| 54 | + # Static content |
| 55 | + - /var/www:/var/www |
| 56 | + |
| 57 | + # Specify exports and customizations |
| 58 | + - ./specify_exports:/home/specify/webportal-installer/specify_exports |
| 59 | + - ./custom_settings:/home/specify/webportal-installer/custom_settings |
| 60 | + |
| 61 | + # Custom images |
| 62 | + - ./custom-images:/home/specify/ |
| 63 | + |
| 64 | + restart: unless-stopped |
| 65 | +``` |
| 66 | +
|
| 67 | +The server structure should look something like this: |
| 68 | +
|
| 69 | +```bash |
| 70 | +. |
| 71 | +├── custom-images |
| 72 | +│ ├── custom-images |
| 73 | +│ └── webportal-installer |
| 74 | +├── custom_settings |
| 75 | +│ ├── README.md |
| 76 | +│ ├── VIMSWebPortal |
| 77 | +│ ├── bishopmuseum |
| 78 | +│ ├── cryoarks |
| 79 | +│ ├── emoryherbarium |
| 80 | +│ ├── fwrf |
| 81 | +│ ├── fwri |
| 82 | +│ ├── iz |
| 83 | +│ ├── morpaleo |
| 84 | +│ ├── newmexico |
| 85 | +│ ├── os_webportal_mapping |
| 86 | +│ ├── osichthyology |
| 87 | +│ ├── sbmnhiz |
| 88 | +│ ├── shellmuseum |
| 89 | +│ ├── shellmuseum-1 |
| 90 | +│ ├── unsmvp |
| 91 | +│ ├── uwfc |
| 92 | +│ ├── webportalfish |
| 93 | +│ └── wespalcoll |
| 94 | +├── docker-compose.yml |
| 95 | +├── git |
| 96 | +│ └── webportal-installer |
| 97 | +├── specify_exports |
| 98 | +│ ├── PortalFiles |
| 99 | +│ ├── README |
| 100 | +│ ├── VIMSWebPortal.zip |
| 101 | +│ ├── backup |
| 102 | +│ ├── bishopmuseum.zip |
| 103 | +│ ├── cryoarks.zip |
| 104 | +│ ├── emoryherbarium.zip |
| 105 | +│ ├── fwrf.zip |
| 106 | +│ ├── fwri.zip |
| 107 | +│ ├── iz.zip |
| 108 | +│ ├── morpaleo.zip |
| 109 | +│ ├── newmexico.zip |
| 110 | +│ ├── os_webportal_mapping.zip |
| 111 | +│ ├── osichthyology.zip |
| 112 | +│ ├── sbmnhiz.zip |
| 113 | +│ ├── shellmuseum.zip |
| 114 | +│ ├── uwfc.zip |
| 115 | +│ ├── webportalfish.zip |
| 116 | +│ └── wespalcoll.zip |
| 117 | +└── webportal-installer |
| 118 | + ├── AggregationDoc.txt |
| 119 | + ├── Dockerfile |
| 120 | + ├── LICENSE |
| 121 | + ├── Makefile |
| 122 | + ├── PortalApp |
| 123 | + ├── README.md |
| 124 | + ├── SearchingDoc.txt |
| 125 | + ├── build |
| 126 | + ├── custom_settings |
| 127 | + ├── get_latest_solr_vers.py |
| 128 | + ├── index_skel.html |
| 129 | + ├── make_fields_template.py |
| 130 | + ├── make_fldmodel_json.py |
| 131 | + ├── make_settings_template.py |
| 132 | + ├── make_solr_xml.py |
| 133 | + ├── make_toplevel_index.py |
| 134 | + ├── no_admin_web.xml |
| 135 | + ├── patch_schema_xml.py |
| 136 | + ├── patch_settings_json.py |
| 137 | + ├── patch_solrconfig_xml.py |
| 138 | + ├── patch_web_xml.py |
| 139 | + ├── solr-7.5.0 |
| 140 | + ├── solr-7.5.0.tgz |
| 141 | + ├── specify_exports |
| 142 | + ├── webportal-nginx.conf |
| 143 | + ├── webportal-solr.service |
| 144 | + └── with_admin_web.xml |
| 145 | +``` |
| 146 | + |
| 147 | +## Adding an Instance |
| 148 | + |
| 149 | +Assuming the export made from Specify 6 is named `DataExport.zip` and it is in the current directory: |
| 150 | + |
| 151 | +```bash |
| 152 | +scp ./DataExport.zip webportal:/home/ubuntu/specify_exports/sbmnhiz.zip |
| 153 | +unzip DataExport.zip |
| 154 | +cd PortalFiles |
| 155 | +scp flds.json webportal:/home/ubuntu/custom_settings/sbmnhiz/fldmodel.json |
| 156 | +cat PortalInstanceSetting.json |
| 157 | +scp PortalInstanceSetting.json webportal:/home/ubuntu/custom_settings/sbmnhiz/settings.json |
| 158 | +``` |
| 159 | + |
| 160 | +This creates the necessary templates for customizing the fields included in the portal and the custom settings. |
| 161 | + |
| 162 | +## Loading New Data |
| 163 | + |
0 commit comments