Add readme instructions for production build

This commit is contained in:
Dana Lambert 2021-11-10 17:32:22 +13:00
parent 2ff2329118
commit 1dcd42b6bc

View file

@ -13,11 +13,7 @@ $ sudo apt install git docker-compose
To install `docker`, follow the [official installation documentation](https://docs.docker.com/get-docker/). [Instructions are also available for `docker-compose`](https://docs.docker.com/compose/install/). To install `docker`, follow the [official installation documentation](https://docs.docker.com/get-docker/). [Instructions are also available for `docker-compose`](https://docs.docker.com/compose/install/).
In order to recieve address data while running in development mode you will need to set an environment variable containing a valid linz data service api key. Such a key can be retrieved by signing up to https://data.linz.govt.nz/. One way of setting the variable is exporting it in the same terminal window that you will run the application. To do this please run the following command: In order to recieve address data while running in development mode you will need to set an environment variable containing a valid linz data service api key. Such a key can be retrieved by signing up to https://data.linz.govt.nz/. One way of setting the variable is exporting it in the same terminal window that you will run the application. To do this please create a .env file in the root directory using `default.env` as an example. Fill in values as appropriate.
```bash
export LINZ_API_KEY=<YOUR_API_KEY>
```
You may also need to give the `dev` script executable permissions using the following command: You may also need to give the `dev` script executable permissions using the following command:
@ -114,3 +110,14 @@ A summary of available commands are outlined below. Note that if the command req
| `reset_database` | Removes, recreates and populates the database | No | `reset_database` | Removes, recreates and populates the database | No
| `build` | Builds required images | No | `build` | Builds required images | No
| `start` | Runs all services including the frontend, backend and postgres database | No | `start` | Runs all services including the frontend, backend and postgres database | No
| `build` | Builds required images (frontend and backend) for production | No
| `start` | Runs all services in production mode including the frontend, backend and postgres database | No
## Running application for production
1. Ensure the prerequisites are met as defined in [#Initial Setup]
2. Create an `.env` file (if not done prior) in the root directory using `default.env` as an example. Fill in the values as appropriate
3. Update `frontend/config.js` with values as appropriate
4. Run a production build using `./dev build_production`
5. Initialise the database using `./dev init_database`
6. Run the production application using `./dev start_production`