scriptingislife / Mapper-Server

Map and visualize SSH logins from sensors.
4 stars 2 forks source link

Deploy server and database using docker #3

Open scriptingislife opened 6 years ago

scriptingislife commented 6 years ago

@congto @MinhKMA

I made Dockerfile-server and Dockerfile-db. I'd recommend updating your repos.

The server uses the python container built on top of Alpine. The database uses the MariaDB container.

After cloning this repo I ran these commands to get it up and running. Next I want to link them so the server can communicate with the database.

docker build -f Dockerfile-server . docker run -d --name mapperserver -p 5000:5000 <build server image>

docker build -f Dockerfile-db . docker run -d --name mapperdb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret <built db image>

Let me know if this works for you. The sensor setup is so simple I'm not sure it needs a container. Also it needs access to the auth.log file.

congto commented 6 years ago

@becksteadn

Sorry, this week I am busy, I am not testing your guide. But I see your missing guide

This docker build -f Dockerfile-server. I think, it is correct docker build -f Dockerfile-server . You are missing dot in comand.

I will test your script over the weekend. Thanks

congto commented 6 years ago

@becksteadn

I reviewed your docker-compose file (1) . What do you think if the docker-compose using option depends_on ?. Example:

 mapperserver:
    depends_on:
      - mapperdb

Thanks

Ref

(1) https://github.com/becksteadn/Mapper-Server/blob/master/docker-compose.yml#L12-L13

congto commented 6 years ago

Hi @becksteadn

I am trying your guide (1), but I have got error in picture (2). I think, container DB have a problem permission user in picture (3). Please, can you check sql script createdb.sql

Thanks

REF:

(1) https://github.com/becksteadn/Mapper-Server/issues/3#issue-325542453

(2) http://prntscr.com/jmlalo

(3) http://prntscr.com/jmldtl

scriptingislife commented 6 years ago

Yeah the mapperserver user was originally only allowed to access the DB on localhost when I planned on using one container. Now it needs to come from the mapperserver host.

scriptingislife commented 6 years ago

docker-compose up should work properly now. The only thing I'm struggling with is getting the server to delay running draw_map.py until the database is reachable.

Thanks for your suggestions. Docker is a really great platform.