islandora-interest-groups / Islandora-DevOps-Interest-Group

The purpose of the Islandora DevOps Interest Group is to make it easier for endusers, developers, testers, and system administrators to understand, deploy, tune and secure the Islandora stack (and associated tools) in their respective hosting environments.
14 stars 17 forks source link

Issue 15 #24

Closed lutaylor closed 7 years ago

lutaylor commented 8 years ago

See issue #15 for more information. Bringing versions to be closer to vagrant environment.

PR 17 to see other changes.

-Note java opts vary between java versions things like -XX:MaxPermSize=512m are retried and CMSClassUnloadingEnabled is enabled by default.

Broke out external tomcat to match tomcat version in vagrant box.

Removed multi fgs notes and added a link at the bottom if people are interested in learning more. multifgs updaters not default in vagrant box. People also need to be careful enabling it by default since it can drastically increase HEAP pressure.

DonRichards commented 7 years ago

I got an error on something you didn't change but should be updated. Ghost script URL changes to http://downloads.ghostscript.com/public/old-gs-releases/ghostscript-9.05.tar.gz

But the part where you added between JAVA and FITS I is really difficult to follow. The formatting looks like it may not be translating correctly. Would you mind looking at this?

Adds Fedora User and adds fedora environment variables to /etc/profile.d/fedora.sh

FEDORA_USER_TEST=`getent passwd $FEDORA_USER`

if [ "$FEDORA_USER_TEST" = "" ]; then useradd -m -d $FEDORA_HOME -s /bin/false $FEDORA_USER ` Make environment variables match with what we set above: echo -e 'export FEDORA_HOME=/usr/local/fedora\nexport CATALINA_HOME=/usr/local/fedora/tomcat\nexport CATALINA_PID="$CATALINA_HOME/catalina.pid"\nexport JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=/usr/local/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat"\nexport JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre\nexport FEDORA_USER=fedora' > /etc/profile.d/fedora.sh sed -i "s|JAVA_OPTS=\"-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=/usr/local/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat\"|JAVA_OPTS=\"$JAVA_OPTS\"|g" /etc/profile.d/fedora.sh sed -i "s|FEDORA_HOME=\"/usr/local/fedora\"|FEDORA_HOME=\"$FEDORA_HOME\"|g" /etc/profile.d/fedora.sh sed -i "s|CATALINA_HOME=\"/usr/local/fedora/tomcat\"|CATALINA_HOME=\"$CATALINA_HOME\"|g" /etc/profile.d/fedora.sh sed -i "s|FEDORA_USER=fedora|FEDORA_USER=$FEDORA_USER|g" /etc/profile.d/fedora.sh sed -i "s|JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre|JAVA_HOME=$JAVA_HOME|g"/etc/profile.d/fedora.sh else echo -e "fedora user already exists\n"`fi

lutaylor commented 7 years ago

@DonRichards I cleaned up the markup and fixed that gs link. Did you want to take another look?

Thanks!

DonRichards commented 7 years ago

Will do right now.

DonRichards commented 7 years ago

I'm still not sure about this line "Adds Fedora User and adds fedora environment variables to /etc/profile.d/fedora.sh"

Is this telling me what was added or something that needs to be added to fedora.sh?

lutaylor commented 7 years ago

Does that make more sense? I just updated it. @DonRichards

DonRichards commented 7 years ago

-bash: getent: command not found

DonRichards commented 7 years ago

You're referencing Variables that aren't set yet?

lutaylor commented 7 years ago

@DonRichards

You likely have to re-source if you exited out.

see section

Source environment (Please note: this must be redone if you close your shell mid-install):

chmod +x ~/islandora-install.properties

. ~/islandora-install.properties

DonRichards commented 7 years ago

My bad. Thanks. Cannot get this line to work.

$ echo -e 'export FEDORA_HOME=/usr/local/fedora\nexport CATALINA_HOME=/usr/local/fedora/tomcat\nexport CATALINA_PID="$CATALINA_HOME/catalina.pid"\nexport JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=/usr/local/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat"\nexport JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre\nexport FEDORA_USER=fedora' > /etc/profile.d/fedora.sh

-bash: /etc/profile.d/fedora.sh: Permission denied
DonRichards commented 7 years ago

OK, so here how I'm looking at it. https://gist.github.com/e9fb70b397aab03567e2d6d355e802b8 What am I missing at this part?

lutaylor commented 7 years ago

@DonRichards Ah I think the problem is that the guide was written assuming that you were logged in as root e.g. sudo bash -l not really as a complete shell script running under a non-root user account. I might put a note about this.

If you don't source the variables and re-source with sudo the variables might not carry forward when running sudo since I don't think it preserves by default.

e.g. sudo . ~/islandora-install.properties

In your case for the echo -e you didn't sudo it so you couldn't write to the /etc/profile.d?

Are you proposing to replace the guide with the script or are you just doing that for testing?

DonRichards commented 7 years ago

Can you look at the Monit part? Formatting seems to be an issue.

lutaylor commented 7 years ago

@DonRichards

mmm I ran though what is in my current pull and it worked ok. I compared what is in your script vs the pull and it seems to be missing a bunch of whitespace the section it is trying to edit looks like this so the whitespace would have to match

# set httpd port 2812 and
#    use address localhost  # only accept connection from localhost
#    allow localhost        # allow localhost to connect to the server and
#    allow admin:monit      # require user 'admin' with password 'monit'
#    allow @monit           # allow users of group 'monit' to connect (rw)
#    allow @users readonly  # allow users of group 'users' to connect readonly
DonRichards commented 7 years ago

Line 334

I think your IDE might be making it look correctly but if you navigate to the PR

The lines don't look right and aren't executing for me.

lutaylor commented 7 years ago

Odd I retested from the README in my fork as well as directly from your link and I am unable to replicate the issue.

This is what I see and it works fine when I copy and paste it

echo -e "check process openoffice\n        matching \"/usr/lib/libreoffice/program/soffice.bin\"\n        start program = \"/etc/init.d/openoffice start\"\n        stop program = \"/etc/init.d/openoffice stop\"\n        if failed host 127.0.0.1 port 8100 then restart\n        if 5 restarts within 5 cycles then timeout" > $MONIT_CONF_DIR/openoffice.conf

sed -i 's|# set httpd| set httpd|g' $MONIT_CONFIG_FILE

sed -i 's|#    use address|    use address|g' $MONIT_CONFIG_FILE

sed -i 's|#    allow localhost|    allow localhost|g' $MONIT_CONFIG_FILE

sed -i 's|    allow admin:monit|#    allow admin:monit|g' $MONIT_CONFIG_FILE

sed -i 's|    allow @monit |#    allow @monit |g' $MONIT_CONFIG_FILE

sed -i 's|    allow @users readonly |#    allow @users readonly |g' $MONIT_CONFIG_FILE

service monit restart

Is github doing something strange? Can you paste the code that you are seeing?

axfelix commented 7 years ago

I admit I'm not 100% paying attention to this thread, but is there a reason we're centralizing on running an OpenOffice service rather than running unoconv per-process? The latter is less fiddly in my experience...

DonRichards commented 7 years ago

@axfelix Thanks for pointing that out. Was it in this repo before and/or somewhere else here?

axfelix commented 7 years ago

I know I brought it up on a call once... but that might be the extent of the discussion here.

lutaylor commented 7 years ago

@axfelix Might want to open up a Jira ticket with your suggestion? Changes would have to be made to module code to work with per-process vs service.

lutaylor commented 7 years ago

@DonRichards

Any luck with the monit section? Still not understanding why you seem to be seeing something different from what I am seeing. Can you copy and paste the code block here and let me know what errors you are getting?

DonRichards commented 7 years ago

@lutaylor Yes, from what you pasted into this thread I was able to get it. I'm note sure why when I copied it out of the original md it failed.

lutaylor commented 7 years ago

@DonRichards

odd for the

There's a a mismatch of single and double quotes on the echo for "Add a mysql backup script:"

I just tested it and it worked fine?

This is what I copied out of the md from the pull

if [ ! -d /root/bin ]; then
  mkdir -p /root/bin
  fi  
  echo -e '#!/bin/bash\n#\n# Dumps all MySQL databases and removes backups older than 1 week\n# With optional scp to another host\n\nBackupFolder=/dbbackups\nMySQLUser=root\nMySQLPass=PASSWORD\n# These next few are just used for scp, which is optional if DO_SCP != yes\nDO_SCP=no\nREMOVE_LOCAL_COPY=no\nFOLDER=dbBACK/mysql-newdb\nBACKUP_USER=backupuser\nBACKUP_HOST=backuppass\n\nDATE=$(date +%Y%m%d)\nOLDDATE=$(date +%Y%m%d -d ' 7 days ago')\n\nif [ ! -d "$BackupFolder" ]; then\n        mkdir -p "$BackupFolder"\n        if [ $? -gt 0 ]; then\n                echo "ERROR: Could not create $BackupFolder"\n                exit 1\n        fi\nfi\n\nfor dbname in $(mysql --user="$MySQLUser" --password="$MySQLPass" -Bse "show databases"); do\n  rm -f "$BackupFolder/$dbname-$OLDDATE.bz2"\n  DumpName="$BackupFolder/$dbname-$DATE.bz2"\n  mysqldump --user="$MySQLUser" --password="$MySQLPass" --opt "$dbname" | bzip2 -9 >"$DumpName"\n  if [ $? -gt 0 ]; then\n        echo "Backup of $dbname failed! (mysqldump)"\n  else\n        if [ "$DO_SCP" == 'yes' ]; then\n            scp -B -o StrictHostKeyChecking=no "$DumpName" "$BACKUP_USER"@"$BACKUP_HOST":"$FOLDER/"\n            if [ $? -gt 0 ]; then\n                echo "Backup of $dbname failed! (scp)"\n            fi\n            if [ "$REMOVE_LOCAL_COPY" == 'yes' ]; then\n                rm -f "$DumpName"\n            fi\n        fi\n  fi\ndone\n' > /root/bin/mysqlBackup.sh && chmod a+x /root/bin/mysqlBackup.sh
lutaylor commented 7 years ago

@DonRichards Did you happen to try the code that I referenced regarding the echo for the mysql backup script?

DonRichards commented 7 years ago

Running it right now

DonRichards commented 7 years ago

I was able to successfully run through each line but this is going to seem naive but I got no website.

I have a vagrant machine running with this but I think I'm missing something simple.

My ports opened by vagrant. Are these causing the issue?

  22 (guest) => 2222 (host)
  3306 (guest) => 3306 (host)
  8000 (guest) => 8000 (host)
  8080 (guest) => 8080 (host)
lutaylor commented 7 years ago

Can you curl against http://localhost on the vagrant box? Is apache started?

DonRichards commented 7 years ago

curl: (7) Failed to connect to localhost port 80: Connection refused

8000 curl: (52) Empty reply from server

8080 curl: (52) Empty reply from server

lutaylor commented 7 years ago

Is apache service running? You might have to change the port 80 listening port and reference in the vhost config to 8000 and access with http://localhost:8000. e.g. kinda like how we are doing it here https://github.com/Islandora-Labs/islandora_vagrant_base_box/blob/master/scripts/drupal.sh#L49-L61

wballum commented 7 years ago

This might help. After completing the setup on vagrant/virtualbox I had to add the following line to my Vagrantfile in order to be able to access the web server via the host OS:

config.vm.network "private_network", type: "dhcp"

After the halt and "vagrant up" a quick ifconfig within the VM shows I now have a "host only" IP 172.28.128.3 that I put into a browser on the host OS and was able to see Islandora.

...

Update Hmm after reading again it does seem that apache may not be running within the VM if

curl localhost

...is not showing you something like:

  <div class="content">
    <span>Powered by <a href="https://www.drupal.org">Drupal</a></span>  </div>
</div>
  </div>
      </div> <!-- /#footer -->

  </div></div> <!-- /.section, /#footer-wrapper -->

</div></div> <!-- /#page, /#page-wrapper -->
  </body>
</html>
lutaylor commented 7 years ago

Good catch @wballum and @DonRichards !

I see the problem I have updated the quotes.

lutaylor commented 7 years ago

@DonRichards Think we are close to being able to merge this?

DonRichards commented 7 years ago

I'll try to walk through this today to see if we can wrap this up.

lutaylor commented 7 years ago

Need to put in a pull similar to https://github.com/Islandora-Labs/islandora_vagrant_base_box/pull/23 on this. However should try to get this merged first to avoid merge conflicts.

lutaylor commented 7 years ago

@DonRichards

Could we merge this? I want to follow up with additional pulls/fixes. In the future I will do smaller pulls to make it more manageable. A lot of formatting etc got fixed in this one which makes it difficult to follow up with other pulls. The longer we leave it the more followup fixes will be needed. The difficulty of the documentation is that it should be considered "living" since various packages end up changing or not being available overtime.

DonRichards commented 7 years ago

On it.

DonRichards commented 7 years ago

But I've somehow lost admin access to this...?

manez commented 7 years ago

Not sure what's up there @DonRichards but I have put you back into the Admin group for this repo