Re: Apache config
Brad Stone <[email protected]> Mon, 24 Oct 2022 08:31:10 -0500
| Newsgroups | gmane.comp.systems.as400.web |
|---|---|
| Message-ID | <CAAGV8Oc5uTvUuuTdYkPThHS8izdtG62NDKd-rDCq-rZTP6mdmQ@mail.gmail.com> |
On Sun, Oct 23, 2022 at 9:56 PM <[email protected]> wrote: > Here is the link that you sent. > https://fieldexit.com/forum/display?threadid=522 I do see that it is 4 > years old so it is probably obsolete. :) > No environment variables setting the library list there. :) Not obsolete either. I still use similar if not exact setups like this to this day. Let me know why you'd think that it would be obsolete. > > So the library list is in a file stored on the IBM i, correct? How does > your process know which file to read to get the library list if there are > multiple environments (different libls)? It seems like I will need to add > another field in my json to tell it that. It also seems like all of the > push and pop would create a chunk of overhead. When I get the real app > working (I'm still playing with concept at this point so I only have a > couple), there are actually about 25+ libraries in the library list. That > means 50+ push/pop for every call. Or am I still missing something with > what you are doing? > Yes, that's one way to do it. It knows which environment either by: 1. Its running in it's own library/instance and has different data in the control files or 2. I set an environment variable in the instance (again, one for prod, one for dev) that tells me what environment it is. Like this: SetEnv MY_ENVIRONMENT production I retrieve the MY_ENVIRONMENT env var and I know what to do. But to be honest, I use option #1 much more. No, you wouldn't add environment data to your json... you could, but I wouldn't. 25 libraries? Wow. I didn't see that many in your example. We're dealing mainly with any libraries containing data and/or service programs/programs. Even if its 5-10 you won't notice it as far as performance. And it's very scalable and updatable without having to end/restart your instances. You can do what you want, just make 2 libraries (or more). 1 for dev/test, 1 for prod and run them on separate instances each running on a different port (or even different IP addresses). Each instance will have the library list for the environment. I do the above even if I'm not using environment variables to set the library list in the Apache config. When you restart or stop your dev instance, do you really want to combine it with prod and shut them both down? > Does your process do an HTTP POST or am I trying to make my process work > like yours and they are apples and oranges. > Doesn't matter. > And my apologies if I sounded short with any of my comments / questions. I > feel like I am trying to tread water wearing a concrete overcoat and it is > getting frustrating. > I understand. Slow down, keep it simple, and listen to others who are trying to help. Bottom line, think about running a separate instance for each environment and set the library list in each one separately. That's my advice. > > -----Original Message----- > From: WEB400 <[email protected]> On Behalf Of Brad Stone > Sent: Sunday, October 23, 2022 8:58 PM > To: Web Enabling the IBM i (AS/400 and iSeries) <[email protected] > > > Subject: Re: [WEB400] Apache config > > What link did I send you? I recall sending someone a generic Apache config > posted at Fieldexit.com... or maybe an IBM link that may have had it. > > Here's how I do it. > > pushLib('datalib'); > //do eRPG stuff > popLib('datalib'); > > I wrote pushLib and popLib years ago. Inside of it there also are > functions > that can set a library list using a job description (I don't think > attaching > a job description to QTMHHTTP or QTMHHTP1 will change their functioning > library list... and it's also not easily changed each program run). > > Control files are pretty simple... > > sequence > library > > Read through it by sequence and for each library pushLib()... then at the > end popLib(). You can even make a nice ILE function to do this. > > I was sharing how I have done things for over 25 years with great success. > Sorry if it confused you. > > On Sun, Oct 23, 2022 at 7:27 PM <[email protected]> wrote: > > > I am so totally confused by what I am being told. > > > > I am trying to run an Angular / javascript app in the browser that > > does an HTTP / Apache connection to get the data. The program that it > > is running > > (HTTPDATA) is a generic "SQL server" program that can take any SQL > > request and process it. As for the Angular / javascript part, it is > > unable to touch anything on the PC. > > > > Now to this response. > > > > You said that you never used those environment variables to set the > > libl yet that is what was in the link that you sent me for how to > > configure apache. > > I assumed that was what I needed to use. > > > > So to do it differently, you suggest a control file with a jobd or > > library list. Where is this control file stored? I'm guessing that > > it has to be on the IBM i somewhere because again, I can't access the > > PC with my app. > > > > For the jobd part of your response, I am not starting a job (maybe it > > is auto started behind the scenes when I connect) so how do I specify > > a jobd for a job that I am not submitting? > > > > I am really struggling to find good documentation and I know part of > > that is because I don't fully understand what I am trying to do and > > much of what I read does not make sense. When Brad provided the link > > for the apache configuration script file, I spent a ton of time trying > > to figure out where it was so I could edit it. I finally noticed that > > I can edit the config in the HTTPAdmin page. I still have not clue > > where it put the thing. > > > > Is there somewhere that I can get "step by step instructions for dummies" > > on > > the best way to do this stuff? > > > > -----Original Message----- > > From: WEB400 <[email protected]> On Behalf Of Brad > > Stone > > Sent: Sunday, October 23, 2022 3:56 PM > > To: Web Enabling the IBM i (AS/400 and iSeries) > > <[email protected] > > > > > Subject: Re: [WEB400] Apache config > > > > I never used those environment variables to set the libl. I use my > > push and pop libl functions. Much more convenient and no stopping and > > starting the instance if it changes. > > > > A simple control file to point to a job description (heaven forbid > > those are > > used!) or just a simple library list file. Easily updatable for the > > next time the program runs. > > > > On Sun, Oct 23, 2022 at 11:56 AM Vern Hamberg via WEB400 < > > [email protected]> wrote: > > > > > Shouldn't the OP be fine using those settings but specify the same > > > program in each? It seems he has only to retrieve the value of the > > > QIBM_CGI_LIBRARY_LIST environment variable and set the LIBL from it? > > > The docs say "The internal environment variables set by this > > > directive are set after most early request processing directives are > > > run", so it probably depends on timing. > > > > > > I speak from long-time-ago working with this stuff, so please > > > forgive if I'm as clueless as ever! > > > > > > Regards > > > Vern > > > > > > On 10/23/2022 9:09 AM, Brad Stone wrote: > > > > Yes, but you'd need to control the library list in your program > itself. > > > > > > > > What I do is set an environment variable to prod or test, retrieve > > > > it, > > > and > > > > set the library list dependent on that at the beginning of the > program. > > > I > > > > have some push and pop lib functions I use for that. > > > > > > > > But in your case I don't see an issue.. I would personally prefer > > > > 2 > > > apache > > > > instances, one for prod and one for test/dev as well as separate > > > > libraries. Then I would run the test one on a different port > > > > (like > > > > 8080 > > > or > > > > 8443). > > > > > > > > On Sun, Oct 23, 2022 at 7:46 AM<[email protected]> wrote: > > > > > > > >> I have the following in my apache config file. > > > >> > > > >> > > > >> > > > >> ScriptAlias /httpprod /qsys.lib/httpprod.lib/httpdata.pgm > > > >> > > > >> <Directory /qsys.lib/httpprod.lib> > > > >> > > > >> SetEnv QIBM_CGI_LIBRARY_LIST > "QTEMP;QGPL;YAJL;httpproda;httpprodb" > > > >> > > > >> allow from all > > > >> > > > >> order allow,deny > > > >> > > > >> Options +ExecCGI +Includes > > > >> > > > >> SetOutputFilter Includes > > > >> > > > >> </Directory> > > > >> > > > >> > > > >> > > > >> ScriptAlias /httptest /qsys.lib/httptest.lib/httpdata.pgm > > > >> > > > >> <Directory /qsys.lib/httptest.lib> > > > >> > > > >> SetEnv QIBM_CGI_LIBRARY_LIST > "QTEMP;QGPL;YAJL;httptesta;httptestb" > > > >> > > > >> allow from all > > > >> > > > >> order allow,deny > > > >> > > > >> Options +ExecCGI +Includes > > > >> > > > >> SetOutputFilter Includes > > > >> > > > >> </Directory> > > > >> > > > >> > > > >> > > > >> I am using the alias to control the library list between my prod > > > >> and > > > test > > > >> data. With this config, I have to have two copies of > > > >> httpdata.pgm, one > > > in > > > >> each library. Is there a way to configure this so both aliases > > > >> call the same program such as /qsys.lib/httpcommon.lib/httpdata.pgm? > > > >> > > > >> > > > >> > > > >> -- > > > >> This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) > > > >> mailing list To post a message email:[email protected] To > > > >> subscribe, unsubscribe, or change list options, > > > >> visit:https://lists.midrange.com/mailman/listinfo/web400 > > > >> or email:[email protected] > > > >> Before posting, please take a moment to review the archives > > > >> athttps://archive.midrange.com/web400. > > > >> > > > >> > > > -- > > > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) > > > mailing list To post a message email: [email protected] To > > > subscribe, unsubscribe, or change list options, > > > visit: https://lists.midrange.com/mailman/listinfo/web400 > > > or email: [email protected] Before posting, please > > > take a moment to review the archives at > > > https://archive.midrange.com/web400. > > > > > > > > -- > > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) > > mailing list To post a message email: [email protected] To > > subscribe, unsubscribe, or change list options, > > visit: https://lists.midrange.com/mailman/listinfo/web400 > > or email: [email protected] Before posting, please > > take a moment to review the archives at > https://archive.midrange.com/web400. > > > > > > -- > > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) > > mailing list To post a message email: [email protected] To > > subscribe, unsubscribe, or change list options, > > visit: https://lists.midrange.com/mailman/listinfo/web400 > > or email: [email protected] Before posting, please > > take a moment to review the archives at > > https://archive.midrange.com/web400. > > > > > -- > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing > list To post a message email: [email protected] To subscribe, > unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/web400 > or email: [email protected] Before posting, please take a > moment to review the archives at https://archive.midrange.com/web400. > > > -- > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing > list > To post a message email: [email protected] > To subscribe, unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/web400 > or email: [email protected] > Before posting, please take a moment to review the archives > at https://archive.midrange.com/web400. > > -- This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/web400 or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/web400.