Problems with missing web static content in httpd proxy build pkg

I’m looking for any help or corrects in my app.

I have an web frontedn app that is a static frontend for a backend system.

My issue the download content that is updated by developers is not in the hart file once I move it toa seperate system. The app works fine in my hab studio,

Restating what I said in slack

ok, I I have a problem. my hart file that I created for my apps web frontend seems to be missing the static files. In my hab studio I see them in /hab/svc/cc-httpd/data however in the package. I don’t see it under/hab/pkgs/lfillmore/cc-hhtpd/2143144/ , the data folder is missing. still new to slack and where I should ask questions. in my studio it works once I offload to the test server site says html files are missing. My question is should I be putting the path in the plan to move the info download from pkg_source to move to /hab/pkgs/lfillmore/cc-httpd/version. I assumed this was automagic I see hooks and config there.

Here is my plan.sh

pkg_name=cc-httpd
pkg_origin=lfillmore
pkg_version="0.0"
pkg_maintainer="Leo"
pkg_license=("Apache-2.0")
pkg_source="http://repo/artifactory/list/cort.tgz/cc-httpd/${pkg_name}-${pkg_version}.tar"
pkg_filename="${pkg_name}-${pkg_version}.tar"
pkg_shasum="370cb2f183490abbe1026546f5ee92802ed6b5d71a12e8cb3f2d9573a2ac5438"
pkg_deps=(core/httpd)
# pkg_build_deps=(core/make core/gcc)
# pkg_lib_dirs=(lib)
# pkg_include_dirs=(include)
# pkg_bin_dirs=(bin)
# pkg_pconfig_dirs=(lib/pconfig)
pkg_svc_user="root"
pkg_svc_group="root"
pkg_svc_run="httpd -DFOREGROUND -f $pkg_svc_config_path/httpd.conf"
pkg_exports=(
  [host]=srv.host
  [port]=srv.port
  [cc-port]=cc.port
 )

 do_begin() {
  return 0
}

do_clean() {
      return 0
}

do_download() {
    build_line "do_download() =================================================="
    cd ${HAB_CACHE_SRC_PATH}
    wget  $pkg_source
 #   tar -xvf $pkg_filename
   return 0
}

do_build() {
  return 0
}

do_install() {
    mv ${HAB_CACHE_SRC_PATH}/docroot $pkg_svc_data_path
    rm -Rf ${HAB_CACHE_SRC_PATH}/*.tar
  return 0
}

hey @lfillmore.

I think you want to change your plan to look like:

pkg_name=cc-httpd
pkg_origin=lfillmore
pkg_version="0.0"
pkg_maintainer="Leo"
pkg_license=("Apache-2.0")
pkg_source="http://repo/artifactory/list/cort.tgz/cc-httpd/${pkg_name}-${pkg_version}.tar"
pkg_filename="${pkg_name}-${pkg_version}.tar"
pkg_shasum="370cb2f183490abbe1026546f5ee92802ed6b5d71a12e8cb3f2d9573a2ac5438"
pkg_deps=(core/httpd)
pkg_svc_user="root"
pkg_svc_group="root"
pkg_svc_run="httpd -DFOREGROUND -f $pkg_svc_config_path/httpd.conf"
pkg_exports=(
  [host]=srv.host
  [port]=srv.port
  [cc-port]=cc.port
 )

do_build() {
  return 0
}

do_install() {
    mkdir -p "${pkg_prefix}/data"
    mv docroot "${pkg_prefix}/data"
}

But you’re also going to want to provide an httpd config to look for your static files in {{pkg.path}}/data

So I want to dig into what this change does:

do_install() {
    mkdir -p "${pkg_prefix}/data"
    mv docroot "${pkg_prefix}/data"
}

In your own plan you’ve referenced $pkg_svc_data_path which is actually a runtime variable. I believe it can theoretically be used at buildtime, but that path is where the service is going to get run from on a system after the service is installed and started. It’s not necessarily the path you want to use during your build.

Typically the ${pkg_prefix} is the install location for built packages so more often than not you’re going to want your build to deposit files there instead. If for some reason you need those files to exist in the same directory structure your binary is being called from you can also always symlink stuff down into {{pkg.svc_foo_path}} in your init or run hook. Your templatized configs will automatically end up in {{pkg.svc_config_path}} but with @elliott-davis change above yours will need to be updated to point to {{pkg.path}}/data to find your static content!

Thanks,

I’ll make that changes @elliot-davis
Thanks for the explanation @eeyun

1 Like

Absolutely and definitely come back here if this doesn’t unblock you!

all working now. thanks for the help. I have to now work on removing a server name to make the app truly agnostic.

Thank again for the help

1 Like