# Continuous Delivery

##### ALL COMMANDS SHOULD EXECUTED FROM THE GIT CONSOLE OR A LINUX TERMINAL

##### Required tools
# Maven
# Node
# Jdk 8

##### Application building
# Run all the tests of the application 
```
mvn verify
```

# Build the application
```
mvn clean package
```

# Run the application (URL: http://localhost:8080)
```
mvn spring-boot:run
```


##### Infrastructure as Code (Terraform)
AWS S3 bucket for Terraform backup: terraform.backup

```
$ cd infrastructure
$ chmod +x infrastructure.sh
$ export AWS_ACCESS_KEY_ID=<your-public-key>
$ export AWS_SECRET_ACCESS_KEY=<your-private-key>
$ export DB_USERNAME=<your-db_password>
$ export DB_PASSWORD=<your-db_username>

$ # Test infrastructure
$ ./infrastructure.sh plan

$ # Create or update infrastructure
$ ./infrastructure.sh apply

$ # Destroy infrastructure
$ ./infrastructure.sh destroy
```

##### Application deploy (Docker)
Docker container: bogdanmarcut91/continuous-delivery

```
# Run the application in localhost from docker
docker run -p 8080:8080 bogdanmarcut91/continuous-delivery:<your version> --name funny-stories
```
