Jaxer Maintenance Blog -Systemd Apache

Okay, that was quick. Managed to get Apache registered to systemd as well. So now we have both of the processes Jaxer and Apache registered of services and that means that we can safely remove the entire scripts folder (yay!). For Apache, the /etc/systemd/system/apache-server.service file is written below.

[Unit]
Description=Mod-Jaxer Http Server
After=network.target

[Service]
Type=notify
ExecStartPre=mkdir -p /opt/AptanaJaxer/Apache22/logs
ExecStart=/opt/AptanaJaxer/Apache22/bin/apachectl start
ExecStop=/opt/AptanaJaxer/Apache22/bin/apachectl stop
User=root
Group=root

[Install]
WantedBy=multi-user.target

It looks pretty simple and it is, because there’s not much to it. The original startApache.sh script sets a few environment variables and then calls apachectl. Originally I attempted to try and set the environment variables in systemd and then call the httpd executable directly, but that didn’t work out too well. So I went back and ended up using apachectl for convenience.

For the environment variables, there ended up being a file called /opt/AptanaJaxer/Apache22/bin/envvars, where the variables are set. So we added JaxerBase and Anchor to that, and then updated the file with source /opt/AptanaJaxer/Apache22/bin/envvars and that allowed us to be able to simply execute apachectl directly.

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# envvars-std - default environment variables for apachectl
#
# This file is generated from envvars-std.in
#
if test "x$LD_LIBRARY_PATH" != "x" ; then
  LD_LIBRARY_PATH="/opt/AptanaJaxer/Apache22/lib:$LD_LIBRARY_PATH"
else
  LD_LIBRARY_PATH="/opt/AptanaJaxer/Apache22/lib"
fi
export LD_LIBRARY_PATH
export JAXERBASE=/opt/AptanaJaxer
export ANCHOR=/opt/AptanaJaxer
#

I’m not sure where the envvars gets created, or edited during the installation process. In general I would be tempted to simply edit the file using python in the Apache prepare script used to install Jaxer. I think I’ve changed enough things that I might take a chance to go back and make sure the install scripts work with a completely fresh environment, and then make sure that everything is working.

As a sidenote, slimming down the install and splitting off Apache has given us some incite into what needs to be set in order for Jaxer to be able to communicate with Apache, so we might give vanilla Apache from yum/apt-get another try now that we can debug what JaxerManager expects to be sent over port 4327 with our Nodejs proxy. Not a priority now, but a possibility. For now it seems like a good idea to take the opportunity to remove the scripts folder, add the systemd scripts into the install and then start with a fresh environment to make sure that everything is working correctly.

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です