Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment fix #35

Merged
merged 3 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@

# Image Storage Microservice

![GitHub issues](https://img.shields.io/github/issues-raw/patlenlix/image-storage)
![GitHub pull requests](https://img.shields.io/github/issues-pr/patlenlix/image-storage)

## Description

Image upload, storage and download microservice using Spring boot, MySQL and local storage. <br/>
This service will be used for the final project of our Webservices course at IT-Högskolan, Gothenburg.

Image upload, storage and download microservice using Spring boot, MySQL and local storage. <br/>
This service will be used for the final project of our Webservices course at IT-Högskolan, Gothenburg.

## Deployment

1. Create network:
`docker network create net`
2. Create volumes:
`docker volume create dataVol`
`docker volume create fileVol`
3. Start consul:
`docker run -d -p 8500:8500 -p 8600:8600/udp --name=consul --network=net consul agent -server -ui -node=server-1 -bootstrap-expect=1 -client='0.0.0.0'
`
4. Start database:
`docker run -d --name database -e MYSQL_ROOT_PASSWORD=root -e 'MYSQL_ROOT_HOST=%' -e MYSQL_DATABASE=images -e MYSQL_USER=user -e MYSQL_PASSWORD=password -p 3306:3306 --network=net -v=dataVol mysql:latest
`
5. Start application
1. build docker image via the dockerfil, name it "app"
2.
run: `docker run -d --name myapp -p 8080:8080 --network=net -v=fileVol -e MYSQL_HOST=database -e CONSUL_HOST=consul app:latest`

## Endpoints

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Database configurations
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3307/images
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/images
spring.datasource.username=user
spring.datasource.password=password
spring.jpa.hibernate.ddl-auto=update
Expand All @@ -10,6 +10,6 @@ spring.servlet.multipart.max-request-size=10MB

#Consul configuration
spring.application.name=image-storage
spring.cloud.consul.host=localhost
spring.cloud.consul.host=${CONSUL_HOST:localhost}
spring.cloud.consul.discovery.enabled=false
spring.config.import=optional:consul:localhost:8500
spring.config.import=optional:consul:${CONSUL_HOST:localhost}:8500