Skip to content

Commit

Permalink
Merge pull request #387 from globocom/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Malinoski authored Mar 28, 2024
2 parents 7f9302e + c87512f commit fcf9caa
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,16 @@ publish: clean
# Containers based target rules
#

start: docker-compose-sdn.yml docker-compose.yml
start_recreate: docker-compose-sdn.yml docker-compose.yml
docker-compose up --force-recreate --remove-orphans -d
docker-compose --file $< up --force-recreate -d


start: docker-compose-sdn.yml docker-compose.yml
docker-compose up -d
docker-compose --file $< up -d


stop: docker-compose-sdn.yml docker-compose.yml
@docker-compose down --remove-orphans

Expand Down Expand Up @@ -172,8 +177,8 @@ endif


build_img: scripts/docker/Dockerfile
docker build -t networkapi:latest --file scripts/docker/Dockerfile .
docker build -t networkapi:$(NETAPI_IMAGE_VERSION) --file scripts/docker/Dockerfile .
docker build --platform=linux/x86_64 -t networkapi:latest --file scripts/docker/Dockerfile .
docker build --platform=linux/x86_64 -t networkapi:$(NETAPI_IMAGE_VERSION) --file scripts/docker/Dockerfile .


push_img: scripts/docker/push_image.sh
Expand Down
20 changes: 13 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ services:
container_name: netapi_db
image: mysql:5.7
platform: linux/x86_64
command: --default-authentication-plugin=mysql_native_password
ports:
- "3306:3306"
- "33306:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_ROOT_PASSWORD: 'put_your_password_here'
volumes:
- netapi_db_vol:/var/lib/mysql
networks:
- netapi_net
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1",-p$$MYSQL_ROOT_PASSWORD ,"--silent"]
interval: 5s
timeout: 3s
retries: 2
start_period: 15s

queue:
container_name: netapi_queue
Expand Down Expand Up @@ -55,11 +62,11 @@ services:
- queue:netapi_queue
- cache:netapi_cache
depends_on:
- queue
- queue

netapi:
container_name: netapi_app
image: globocom:latest
image: networkapi:latest
build:
context: .
dockerfile: ./scripts/docker/Dockerfile
Expand All @@ -79,9 +86,8 @@ services:
networks:
- netapi_net
depends_on:
- db
- queue
- cache
db:
condition: service_healthy
links:
- db:netapi_db
external_links:
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Base stage
#
FROM alpine:3.7 as base
FROM alpine:3.7 as base

RUN apk update

Expand Down
4 changes: 2 additions & 2 deletions scripts/docker/docker-start-netapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ fi


echo "Creating networkapi database"
mysql -u root -h ${NETWORKAPI_DATABASE_HOST} -e 'CREATE DATABASE IF NOT EXISTS networkapi;'
mysql -u root -h ${NETWORKAPI_DATABASE_HOST} -p${NETWORKAPI_DATABASE_PASSWORD} -e 'CREATE DATABASE IF NOT EXISTS networkapi;'


# Running database migrations if exists
cd /netapi/dbmigrate; db-migrate --show-sql


echo "Loading base Network API data into database"
mysql -u root -h ${NETWORKAPI_DATABASE_HOST} networkapi < /netapi/dev/load_example_environment.sql
mysql -u root -h ${NETWORKAPI_DATABASE_HOST} -p${NETWORKAPI_DATABASE_PASSWORD} networkapi < /netapi/dev/load_example_environment.sql


# Discovering SDN controller
Expand Down
8 changes: 4 additions & 4 deletions scripts/docker/netapi.env
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
NETWORKAPI_DATABASE_NAME=networkapi
NETWORKAPI_DATABASE_NAME='networkapi'

NETWORKAPI_DATABASE_USER=root
NETWORKAPI_DATABASE_USER='root'

NETWORKAPI_DATABASE_PASSWORD=
NETWORKAPI_DATABASE_PASSWORD='put_your_password_here'

NETWORKAPI_DATABASE_HOST=netapi_db
NETWORKAPI_DATABASE_HOST='netapi_db'

NETWORKAPI_DATABASE_PORT=3306

Expand Down

0 comments on commit fcf9caa

Please sign in to comment.