diff --git a/ambari/Dockerfile b/ambari/Dockerfile index e41f6e2..c3f93e2 100644 --- a/ambari/Dockerfile +++ b/ambari/Dockerfile @@ -11,8 +11,7 @@ ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 RUN set -xe \ && apt-get update \ - && apt-get install -y curl gnupg libpostgresql-jdbc-java openjdk-8-jdk openssh-client supervisor \ - && mkdir -m 700 /root/.ssh \ + && apt-get install -y curl gnupg libpostgresql-jdbc-java openjdk-8-jdk \ && curl -sSL ${AMBARI_SOURCE} > /etc/apt/sources.list.d/ambari.list \ && apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD \ && apt-get update \ @@ -20,12 +19,8 @@ RUN set -xe \ && ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql.jar \ && rm -rf /var/lib/apt/lists/* -VOLUME /etc/ambari-server/conf/ /root/.ssh/ +VOLUME /etc/ambari-server/conf EXPOSE 8080 CMD ["sleep", "inf"] - -# -# ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql.jar -# diff --git a/ambari/README.md b/ambari/README.md index ad3eb99..0b0eaec 100644 --- a/ambari/README.md +++ b/ambari/README.md @@ -6,5 +6,46 @@ developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use Hadoop management web UI backed by its RESTful APIs. +## docker-compose.yml + +```yaml +ambari: + image: vimagick/ambari + hostname: ambari-server + ports: + - "8080:8080" + volumes: + - ./data/ambari:/etc/ambari-server/conf + links: + - postgres + extra_hosts: + - ambari-agent1:172.16.1.101 + - ambari-agent2:172.16.1.102 + - ambari-agent3:172.16.1.103 + restart: unless-stopped + +postgres: + image: postgres:alpine + volumes: + - /data/postgres:/var/lib/postgresql/data + environment: + - POSTGRES_USER=ambari + - POSTGRES_PASSWORD=ambari + - POSTGRES_DB=ambari + restart: unless-stopped +``` + +> Make sure that ambari-server is reachable by ambari-agents. + +## Up and Running + +```bash +$ docker-compose up -d +$ docker-compose exec ambari bash +>>> ambari-server setup +>>> PGUSER=ambari PGPASSWORD=ambari psql -h postgres -d ambari -f /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql +>>> ambari-server start +$ curl localhost:8080 +``` [1]: https://ambari.apache.org/ diff --git a/ambari/data/ssh/.gitkeep b/ambari/data/ssh/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ambari/data/ssh/config b/ambari/data/ssh/config new file mode 100644 index 0000000..7608811 --- /dev/null +++ b/ambari/data/ssh/config @@ -0,0 +1,11 @@ +Host ambari-agent1 + HostName 172.16.1.101 + User root + +Host ambari-agent2 + HostName 172.16.1.102 + User root + +Host ambari-agent3 + HostName 172.16.1.102 + User root diff --git a/ambari/docker-compose.yml b/ambari/docker-compose.yml index ecc68c6..2ae7ab7 100644 --- a/ambari/docker-compose.yml +++ b/ambari/docker-compose.yml @@ -6,6 +6,8 @@ ambari: volumes: - ./data/ssh:/root/.ssh - ./data/ambari:/etc/ambari-server/conf + links: + - postgres extra_hosts: - ambari-agent1:172.16.1.101 - ambari-agent2:172.16.1.102 @@ -14,8 +16,6 @@ ambari: postgres: image: postgres:alpine - ports: - - "5432:5432" volumes: - /data/postgres:/var/lib/postgresql/data environment: