Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

That app you love, part 3: Every setting in its place

<p>&nbsp;</p> <quillbot-extension-portal></quillbot-extension-portal>

October 4, 2016
N. Harrison Ripps
Related topics:
ContainersDeveloper toolsDevOpsJavaMicroservices
Related products:
Developer Toolset

    Welcome to the third installment of That App You Love, a blog series in which I show you how to you can make almost any app into a first-class cloud citizen. If you want to start from the beginning, jump back and check out Part 1: Making a Connection.

    In Part 2 of this series, we looked at ZNC’s configuration options to decide which settings we wanted to expose to the user, and which settings we could hard-code straight into the container. But don’t forget that we’re not just talking about ZNC - we’re really talking about That App You Love, and how to bring it into the cloud.

    As a recap, we know that we want to hard-code these ZNC settings:

    • Port number: 6697
    • SSL: yes
    • IPv6: no
    • Set up an IRC network: no

    And we want to make these settings configurable:

    • Username
    • Password
    • User display name

    We actually didn’t talk about the user display name in the last post; it isn’t a required setting. But if we’re making the username configurable, why not expose the display name setting as well?

    Many Apps, Many Configuration Paths

    Now, here’s where ZNC and That App You Love will almost certainly have some differences. Some apps have CLI based installation helpers, like ZNC. Others might start with a default config file that you have to edit with the help of a user guide. Either way, your goal now is to produce a valid configuration, and place some environment variables where they will matter to your app deployment.

    In the case of my ZNC app, I decided to drive the configuration through ZNC’s built-in wizard rather than by preparing a “pre-cooked” config file. As an aside - this approach works for me and ZNC, but a different approach may be better for you and That App You Love. In any case, take a gander at a snippet of this swanky script, which uses expect to act like a user and configure ZNC for me:

    spawn /usr/bin/znc -d $env(ZNC_DATADIR) --makeconf
    expect "Listen on port (1025 to 65534):"
    send "6697\r"
    expect "Listen using SSL (yes/no) \[no\]:"
    send "yes\r"
    expect "Listen using both IPv4 and IPv6 (yes/no) \[yes\]:"
    send "no\r"
    expect "Username (alphanumeric):"
    send "$env(ZNC_USER)\r"
    expect "Enter password:"
    send "$env(ZNC_PASS)\r"

    What’s happening here? This script runs the ZNC install wizard, listens for the configuration questions, and answers them. Sometimes it uses hard-coded answers (like the port number) and other times it pulls in the environment variables we conjured up in Part 2.

    Develop First, Containerize Later

    You may have noticed that we’re trying to containerize this app, but haven’t talked about putting this app in an actual container yet. That’s because anything that works inside of a container had better work outside of a container, first. In developing my configuration strategy, I spent a lot of time refining my expect script before I ever bothered building an image.

    In fact, you can see the whole configuration process in action without using the image at all:

    1. To set up this test, you’ll need to install ZNC and expect. Shortcut for Fedora users:
      sudo dnf install znc expect
      
    2. Next, download a copy of the expect script:
      wget https://raw.githubusercontent.com/nhr/znc-cluster-app/master/znc_expect.exp
      
    3. Create a temporary landing pad for the ZNC configuration:
      mkdir /tmp/znc-env
      
    4. And then invoke the expect script. Feel free to play with different values for the environment variables:
      ZNC_USER=foo ZNC_PASS=bar ZNC_NAME=Foo ZNC_DATADIR=/tmp/znc-env expect znc_expect.exp
      
    5. Finally, you can see the generated file with this command:
      cat /tmp/znc-env/configs/znc.conf

    You should see that your values - along with the ones that I decided to hard-code - have been committed to the config file. Your password value in the config file is encrypted; ZNC does that for you, which is one of the reasons I decided not take the “pre-baked” approach to the config file!

    Next Up: State In A Stateless Place

    In this post, we’ve actually covered two important parts of our container design. You may have missed one of them - it was step #1 of our configuration demo, where we installed the software we want to configure. Installing That App You Love will be step #1 of your container image build, as well. The other important part, of course, was the configuration strategy that we used to set the hard-coded and customizable values our app will use. I did it with an expect script - you may use something else.

    But how do we bring this all together into a container image that can install, configure, and run That App You Love? Stay tuned for Part 4: Designing a Config-and-Run Container!

    This series will run every Tuesday and Thursday until we've accomplished our goals, so stay tuned in, subscribe, and thanks for reading!

    Title Date
    That app you love, part 1: Making a connection 2016/09/27
    That app you love, part 2: Immutable but flexible – What settings matter? 2016/09/29
    That app you love, part 3: Every setting in its place 2016/10/04
    That app you love, part 4: Designing a config-and-run container 2016/10/06
    That app you love, part 5: Upping our (cloud) game 2016/10/11
    That app you love, part 6: Container, meet cloud 2016/10/13
    That app you love, part 7: Wired for sound 2016/10/18
    That app you love, part 8: A blueprint for “that app you love” 2016/10/20
    That app you love, part 9: Storage and statefulness 2016/10/25
    That app you love, part 10: Long live “that app you love” 2016/10/27

    About the Author

    Hi there! My name is N. Harrison Ripps, and I am an engineer and people manager on the Containers team at Red Hat. Together with the greater open source community, our team has taken the combination of the docker container format and Google’s Kubernetes orchestration system, and then extended this framework with a number of administrator- and developer-friendly features that we call the OpenShift Container Platform.

    Last updated: January 22, 2024

    Recent Posts

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    • Fun in the RUN instruction: Why container builds with distroless images can surprise you

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.