Your IP : 216.73.216.14


Current Path : /home/deltalab/PMS/
Upload File :
Current File : //home/deltalab/PMS/README.md

# docker-deployment

This project contains what's needed to bring up the PMS platform as a Docker swarm and network

## Prerequisites to deployment

* This repo cloned on the platform host machine
* `docker` installed on the host machine
* `docker-compose` installed on the host machine

:exclamation: Make sure to checkout the branch intended for deploy in the submodules :exclamation:

:exclamation: Make sure the correct .env files are included in the projects in the submodules :exclamation:

:exclamation: Make sure the project in the submodules include either a `Dockerfile` or  a `dockerfile` :exclamation:

## How to deploy the platform
The platform is orchestrated and build via the use of `docker-compose`, and as such, it is based on the `docker-compose.yml` file included in the repo and the project docker images.

### Preparing the environment
- Copy all the projects to the server, overwrite the server's file if updating the platform release.
- Copy the staging (or production) environments into the projects' folders respectively
- Put a copy of the `startup_delay.sh` script in the root of every project.

### Launching the platform
Navigate to the root of the platform on the server, where the `docker-compose.yml` and `Makefile` files are located and simply launch `make`
This command will default to the staging rules of deployment, read further to explore other options.

The Makefile will :sparkles: automagically :sparkles: shutdown the running platform (if so), delete the old images, clean up the containers, rebuild the images and launch a brand new platform.

- `log` option: If access to the real time logging of the platform is needed, when launching the platform use `make log` instead of the standard command.
Please, bear in mind that such action will require a `Ctrl+C` command in order to free the shell, shutting down the platform. As an additional downside, this way of stopping the swarm DOES NOT remove the containers used for the platform. They will, however, be cleaned up on the next platform launch.

- `prod` option: when deploying to the production environment, use `make prod` instead of the standard command in order to launch the platform with the correct configuration.

- `down` & `down_stage` option: To stop the platform, in any moment, simply navigate to the `Makefile` file location and launch `make down` if the platform has been launched in a production environment, or `make down_stage` if it has been launched in staging environment. This will stop every container, remove them and remove the used network.

### Updating the platform

If one of the projects gets updated, the image should be re-compiled in order to update the platform.

- Pull the updated projects in their respective folders.
- Make sure to check all the prerequisites and prepare the enviroment as explained above.
- Launch the `make` command (or `make prod`) as usual.

### Coming Soon :clapper:
- ~~In future works, the `docker-compose.yml` file will handle all the steps, removing the need to compile the images. The manual removal of the images will still be necessary.~~ ~~
- ~~A set of rules compiled in a Makefile file, will automate most of the steps that `docker-compose` can't handle~~
- ~~Prettifying of the Makefile output~~
- Production-wise logic for DB dumps and autorestore etc.