From df7bf74ced58149a08f1cc3f1c87c783cf91ceb0 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Wed, 22 Sep 2021 00:55:43 +0200 Subject: [PATCH] Upgrade setup for Foreman v3.0, Postgres v10 --- docker-compose.yml | 5 +++-- foreman/Dockerfile | 17 +++++++++++++---- foreman/database.yml | 2 +- proxy/Dockerfile | 17 +++++++++++++---- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 78430f9..46bf54a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '2' services: foreman: build: foreman - command: rails server -p 80 -b 0.0.0.0 + command: bundle exec rails server -p 80 -b 0.0.0.0 ports: - 80 volumes: @@ -47,8 +47,9 @@ services: - 1936:1936 db: - image: postgres:9.5 + image: postgres:10 environment: + - POSTGRES_PASSWORD=postgres - PGDATA=/var/lib/postgresql/data/pgdata volumes: - ./pgdata:/var/lib/postgresql/data/pgdata:z diff --git a/foreman/Dockerfile b/foreman/Dockerfile index 45f88bc..48ac3b5 100644 --- a/foreman/Dockerfile +++ b/foreman/Dockerfile @@ -2,10 +2,19 @@ FROM fedora:latest LABEL MAINTAINER="ohadlevy@gmail.com" -#RUN dnf -y update +ARG RUBY_VERSION="2.7" +ARG NODEJS_VERSION="12" +ARG FOREMAN_VERSION="3.0" + +RUN echo -e "[nodejs]\nname=nodejs\nstream=${NODEJS_VERSION}\nprofiles=\nstate=enabled\n" \ + > /etc/dnf/modules.d/nodejs.module \ + && echo -e "[ruby]\nname=ruby\nstream=${RUBY_VERSION}\nprofiles=\nstate=enabled\n" \ + > /etc/dnf/modules.d/ruby.module \ + && dnf -y update + RUN dnf -y install \ ruby{,-devel,gems} \ - rubygem-{nokogiri,bundler,unf_ext,rdoc} \ + rubygem-bundler \ redhat-rpm-config \ nodejs \ npm \ @@ -25,8 +34,8 @@ ENV RAILS_ENV=production ENV FOREMAN_APIPIE_LANGS=en ENV REPO_URL=https://github.com/theforeman/foreman.git -#TODO: support local path instead of checkout -RUN git clone --depth=1 ${REPO_URL} . +# TODO: support local path instead of checkout +RUN git clone --branch ${FOREMAN_VERSION}-stable --depth=1 ${REPO_URL} . RUN [ -e 'package.json' ] && npm install || exit 0 ADD database.yml config/database.yml diff --git a/foreman/database.yml b/foreman/database.yml index c452092..f8ae464 100644 --- a/foreman/database.yml +++ b/foreman/database.yml @@ -4,7 +4,7 @@ production: &default database: postgres pool: 5 username: postgres - password: + password: postgres host: db test: diff --git a/proxy/Dockerfile b/proxy/Dockerfile index b7fec02..c4c95bf 100644 --- a/proxy/Dockerfile +++ b/proxy/Dockerfile @@ -2,10 +2,19 @@ FROM fedora:latest LABEL MAINTAINER="shlomi@ben-hanna.com" -RUN dnf -y update +ARG RUBY_VERSION="2.7" +ARG NODEJS_VERSION="12" +ARG FOREMAN_VERSION="3.0" + +RUN echo -e "[nodejs]\nname=nodejs\nstream=${NODEJS_VERSION}\nprofiles=\nstate=enabled\n" \ + > /etc/dnf/modules.d/nodejs.module \ + && echo -e "[ruby]\nname=ruby\nstream=${RUBY_VERSION}\nprofiles=\nstate=enabled\n" \ + > /etc/dnf/modules.d/ruby.module \ + && dnf -y update + RUN dnf -y install \ ruby{,-devel,gems,-irb} \ - rubygem-{nokogiri,bundler,unf_ext,rdoc} \ + rubygem-bundler \ redhat-rpm-config \ systemd-devel \ nodejs \ @@ -20,8 +29,8 @@ WORKDIR /usr/src/app ENV REPO_URL=https://github.com/theforeman/smart-proxy.git -RUN git clone --depth=1 ${REPO_URL} . \ +RUN git clone --branch ${FOREMAN_VERSION}-stable --depth=1 ${REPO_URL} . \ && mkdir logs -RUN bundle --without bmc:krb5:libvirt:puppet_proxy_legacy:test:windows +RUN bundle --without bmc:krb5:libvirt:puppet_proxy_legacy:test:windows ADD settings.yml config/settings.yml