<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>shussekaidoのブログ</title>
<link>https://ameblo.jp/shussekaido/</link>
<atom:link href="https://rssblog.ameba.jp/shussekaido/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>ブログの説明を入力します。</description>
<language>ja</language>
<item>
<title>VM time sync</title>
<description>
<![CDATA[ <span style="font-size: 14px;">So, I finally got around to troubleshooting time sync in my VMs. When virtual machines resume from standby the date/time in the VM will be behind. After a while you can end up with your VM being days behind the actual date. For some reason I found it difficult to google up a clear solution, which is really strange - you'd think it's a really common issue.<br><br>So, here is a solution that worked for me.&nbsp;First of all you want to make sure your ntpd daemon is set to run at startup. On FreeBSD your <code>/etc/rc.conf</code> needs to have <code>ntpd_enable="YES"</code><br><br>Edit <code>/etc/ntp.conf</code>:<br><br><code><span style="color: rgb(64, 127, 0);"># Add minpoll and maxpoll to your time servers in order to poll time once a minute:</span><br>server 0.freebsd.pool.ntp.org iburst minpoll 6 maxpoll 6<br>server 1.freebsd.pool.ntp.org iburst minpoll 6 maxpoll 6<br>server 2.freebsd.pool.ntp.org iburst minpoll 6 maxpoll 6<br><br><span style="color: rgb(64, 127, 0);"># Uncommment these lines at the end:</span><br>server 127.127.1.0<br>fudge 127.127.1.0 stratum 10<br><br><span style="color: rgb(64, 127, 0);"># Add this line:</span><br>tinker panic 0<br></code><br><br>The <code>tinker panic 0</code> part tells ntpd not to freak out during boot time (otherwise it will throw an error if VM time lag is greater than 10 mins). Most places I googled make it seem like <code>tinker panic 0</code> is the actual solution but in reality it only works when the VM boots up. The edits mentioned above help the VM update the time after resuming from sleep.<br><br>Remember to restart ntpd (service ntpd restart).<br></span><br>
]]>
</description>
<link>https://ameblo.jp/shussekaido/entry-11490052395.html</link>
<pubDate>Thu, 14 Mar 2013 09:35:23 +0900</pubDate>
</item>
<item>
<title>Confluence 5 on FreeBSD 9 with OpenJDK 7</title>
<description>
<![CDATA[ <span style="font-size: 14px; line-height: 21px;">So, I was playing with FreeBSD in a VM and when I realized a default install would boot with 64 MB of ram I started drooling all over it. I run some VMs on my hackintosh and frankly, I'm pretty low on memory. The biggest ram hog is my Confluence wiki in a CentOS 6 VM which I use as a personal wiki. It's probably overkill because it's such a heavy application but it does the job well and I love using it. I tried some lighter wikis but they don't really do it for me. If I didn't have Confluence I would virtualize Microsoft OneNote in a Windows VM.</span><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">So, Confluence has one big problem and the name of the problem is Java. It takes about a gig of ram to run the wiki for me, one humble user. It's ridiculous, ludicrous and preposterous beyond all recognition. Re-write the damn thing for Node, Rails, anything, for the love of kittens! You know, like instead of adding useless trendy social media crap... Or, I swear, I'm just gonna have to build a new box with more RAM... (Tumbleweed). I've actually been running my CentOS-based Confluence VM with 512 MB of ram allocated and just let it swap about 300 megs because I have an SSD and I'm not afraid to use it.&nbsp;</span><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">Where was I? Right, Java is evil and must die. So, Confluence 5 needs JDK 1.7 and I have no freaking clue how to get JDK 1.7 on FreeBSD. Actually I have no freaking clue about FreeBSD in general because I tried it like the other day for the fist time. Poking around, it seems my options are to install JDK 1.6 through some major pain-in-the-ass manual finagling or just say screw it and try OpenJDK 1.7 which isn't (officially) supported by Confluence.</span><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">If you googled your way here be forewarned I am not an admin, I'm just playing around.</span><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">Today's ingredients:</span><br style="font-size: 14px; line-height: 21px;"><b style="font-size: 14px; line-height: 21px;">FreeBSD 9.1 i368 VM (1 GB RAM)<br>OpenJDK 7<br>PostgreSQL 9.2<br>Confluence 5.0.1</b><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><h3>Prepare ports, shell, repo source</h3><blockquote style="font-size: 14px; line-height: 21px;"><code># On brand new FreeBSD do:<br>portsnap fetch extract<br>&nbsp;<br># Otherwise do:<br>portsnap fetch update<br></code></blockquote><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">Note that some commands below won't work in default csh. Use zsh, bash or change to commands for your shell.</span><br style="font-size: 14px; line-height: 21px;"><blockquote style="font-size: 14px; line-height: 21px;"><code># Change shell to ZSH<br>cd /usr/ports/shells/zsh &amp;&amp; make install clean<br><br># this will change shell for current user<br>chsh -s /usr/local/bin/zsh<br>&nbsp;<br># Change repo source to something that works for you<br>export PACKAGESITE="ftp://ftp6.ru.freebsd.org/pub/FreeBSD/ports/`uname -m`/packages-9-current/Latest/"<br>&nbsp;<br>pkg_add -r wget<br></code></blockquote><br style="font-size: 14px; line-height: 21px;"><h3>OpenJDK is the easy part</h3><blockquote style="font-size: 14px; line-height: 21px;"><code>pkg_add -r openjdk7<br><br><br># java -version<br>openjdk version "1.7.0_06"<br>OpenJDK Runtime Environment (build 1.7.0_06-b24)<br>OpenJDK Client VM (build 23.2-b09, mixed mode)</code></blockquote><br style="font-size: 14px; line-height: 21px;"><h3>Install Confluence</h3><span style="font-size: 14px; line-height: 21px;">Go to http://atlassian.com/software/confluence/download and check for latest version (Standalone, in either OS X or Linux section).</span><blockquote style="font-size: 14px; line-height: 21px;"><code>mkdir /usr/local/confluence/ &amp;&amp; cd /usr/local/confluence/<br><br>wget --no-check-certificate "http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-5.0.1.tar.gz" &amp;&amp; mv atlas* confluence.tar.gz<br><br>tar zxvf confluence.tar.gz &amp;&amp; rm confluence.tar.gz<br><br>ln -s /usr/local/confluence/atlassian-confluence-5.0.1/ /usr/local/confluence/current<br>&nbsp;&nbsp;<br>mkdir confluence-home<br><br>echo 'confluence.home=/usr/local/confluence/confluence-home/' &gt; /usr/local/confluence/current/confluence/WEB-INF/classes/confluence-init.properties<br>&nbsp;&nbsp;<br>echo -e 'JAVA_HOME="/usr/local/openjdk7/"\nexport JAVA_HOME\n' &gt;&gt; /usr/local/confluence/current/bin/setenv.sh<br>&nbsp;&nbsp;<br>pw add user confluence -d /usr/local/confluence/confluence-home -s /bin/sh -m<br><br>chown -R confluence:confluence /usr/local/confluence<br>&nbsp;&nbsp;<br># Start Confluence<br>sh /usr/local/confluence/current/bin/start-confluence.sh<br>&nbsp;&nbsp;<br># check log<br>tail -f /usr/local/confluence/current/logs/catalina.out<br></code></blockquote><br style="font-size: 14px; line-height: 21px;"><h3>Add Confluence to startup</h3><span style="font-size: 14px; line-height: 21px;">Put this script into&nbsp;</span><code style="font-size: 14px; line-height: 21px;">/usr/local/etc/rc.d/confluence.sh</code><br style="font-size: 14px; line-height: 21px;"><blockquote style="font-size: 14px; line-height: 21px;"><code>#!/bin/sh<br># PROVIDE: confluence<br># REQUIRE: postgresql<br># BEFORE: LOGIN<br># KEYWORD: shutdown<br>&nbsp;&nbsp;<br>confluence_root="/usr/local/confluence/current"<br>JAVA_HOME="/usr/local/openjdk7/"<br>export JAVA_HOME<br>. /etc/rc.subr<br>name="confluence"<br>rcvar=${name}_enable<br>start_cmd="${name}_start"<br>stop_cmd=":"<br>load_rc_config $name<br>: ${confluence_enable:=no}&nbsp;<br>: ${confluence_msg="Starting Confluence."}<br>confluence_start()<br>{<br>${confluence_root}/bin/startup.sh start || err 1 "Error starting Confluence!"<br>}<br>load_rc_config $name<br>run_rc_command "$1"<br></code></blockquote><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">Make it executable and enable it.</span><code style="font-size: 14px; line-height: 21px;"></code><blockquote style="font-size: 14px; line-height: 21px;"><code>chmod +x /usr/local/etc/rc.d/confluence.sh<br>echo 'confluence_enable="YES"' &gt;&gt; /etc/rc.conf</code></blockquote><br style="font-size: 14px; line-height: 21px;"><h3>Install PostgreSQL</h3><blockquote style="font-size: 14px; line-height: 21px;"><code>pkg_add -r postgresql92-server<br>&nbsp;<br>echo 'postgresql_enable="YES"' &gt;&gt; /etc/rc.conf<br>/usr/local/etc/rc.d/postgresql initdb<br>service postgresql start<br>&nbsp;<br># Create Confluence user and DB:<br>su pgsql<br>$ createuser -SDRP confuser<br>Enter password for new role: ******<br>Enter it again: ******<br>&nbsp;&nbsp;<br>$ createdb confluence --owner=confuser --encoding=UTF-8 -e<br>&nbsp; &nbsp;<br># List databases and owners:<br>&nbsp;psql -l<br>$ exit<br>service postgresql restart<br></code></blockquote><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">You're basically done, you can now access your machine's hostname on port 8090 in the browser. Or you could drop that :8090 thingie.</span><br style="font-size: 14px; line-height: 21px;"><h3>Forward port 80 to 8090</h3><blockquote style="font-size: 14px; line-height: 21px;"><code># If you don't have a firewall enabled yet, let's enable PF<br># The kernel will be recompiled with the firewall enabled<br>&nbsp;<br># If you don't have FreeBSD source, get it:<br>wget -P /usr/local/ ftp://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/`uname -r`/src.txz &amp;&amp; tar -C / -xvzf src.txz &amp;&amp; rm /usr/local/src.txz<br>&nbsp;&nbsp;<br>cp /usr/src/sys/`uname -m`/conf/GENERIC /usr/src/sys/`uname -m`/conf/PF<br>&nbsp;&nbsp;<br># Note, this long-ass thing is a long-ass command, paste the whole thing<br>echo -e '\ndevice pf\ndevice pflog\ndevice pfsync\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ_CBQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Class Bases Queuing (CBQ)\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ_RED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Random Early Detection (RED)\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ_RIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # RED In/Out\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ_HFSC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Hierarchical Packet Scheduler (HFSC)\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ_PRIQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Priority Queuing (PRIQ)\noptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALTQ_NOPCC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Required for SMP build/n' &gt;&gt; /usr/src/sys/`uname -m`/conf/PF<br>&nbsp;&nbsp;<br># To update the kernel faster or to build only custom modules, edit /etc/make.conf before starting to build the kernel:<br>echo 'MODULES_OVERRIDE = pf' &gt;&gt; /etc/make.conf<br># This variable specifies the list of modules to build instead of building everything.<br>&nbsp;<br>cd /usr/src &amp;&amp; make buildkernel KERNCONF=PF<br>make installkernel KERNCONF=PF<br>echo -e '\npf_enable="YES"\npf_rules="/etc/pf.conf"\n' &gt;&gt; /etc/rc.conf<br>&nbsp;<br>&nbsp;<br># Forward the port&nbsp;<br>echo 'rdr on em0 proto tcp from any to any port 80 -&gt; 127.0.0.1 port 8090' &gt;&gt; /etc/pf.conf<br>&nbsp;<br># reboot<br>init 6<br></code></blockquote><br style="font-size: 14px; line-height: 21px;"><h3>Finito la comedia</h3><span style="font-size: 14px; line-height: 21px;">You're done! Access your Confluence server hostname in the browser.</span><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><h3>A little troubleshooting</h3><span style="font-size: 14px; line-height: 21px;">I imported my database and attachments from Confluence 4 and it ran like a champ on 1 gig of ram. That is, until it became fubar. I don't know if it's something I did (probably), but I was testing it at 512 megs of ram (it got painfully slow) and then back to 1 gig and then BOOM I got an error like this:</span><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><code style="font-size: 14px; line-height: 21px;">com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException</code><br style="font-size: 14px; line-height: 21px;"><br style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px; line-height: 21px;">Confluence would crash every time I accessed the wiki. Turns out my PostgreSQL daemon crashed so hard it couldn't get back up.</span><blockquote style="font-size: 14px; line-height: 21px;"><code>service postgresql restart<br>&gt; pg_ctl: invalid data in PID file "/usr/local/pgsql/data/postmaster.pid"<br><br># When in doubt, RM.<br>rm /usr/local/pgsql/data/postmaster.pid&nbsp;<br><br>service postgresql restart<br>&gt; FATAL: &nbsp;bogus data in lock file "/tmp/.s.PGSQL.5432.lock": ""<br>&gt; pg_ctl: could not start server<br><br># Whatever, dude. R effin' M.<br>rm /tmp/.s.PGSQL.5432.lock<br><br>service postgresql restart<br>service postgresql status<br>&gt; pg_ctl: server is running (PID: 1467)<br><br># Much better. Restart and you're in business.</code></blockquote><h3>Postmortem</h3><span style="font-size: 14px; line-height: 21px;">A couple things to note:</span><ul style="font-size: 14px; line-height: 21px;"><li>At 512 MB ram Confluence is noticeably faster on CentOS+JDK1.7 than on FreeBSD+OpenJDK7. I do have Confluence 4 on CentOS still, so don't know if that's a variable as well.</li><li>I also tried Confluence 4 on FreeBSD9.0+JDK1.6. It didn't feel fast at 1 gig and it puked at 512 ram (same PostgreSQL crash).<br><br></li></ul><h3>Update</h3><span codelinebreak"--="" style="font-size: 14px;">Crashed with the following error:<br><blockquote><code><blockquote># A fatal error has been detected by the Java Runtime Environment:</blockquote><blockquote># &nbsp;SIGSEGV (0xb) at pc=0x281a01a6, pid=1336, tid=1636939520</blockquote><blockquote># JRE version: 7.0-b24</blockquote><blockquote># Java VM: OpenJDK Client VM (23.2-b09 mixed mode bsd-x86 )</blockquote><blockquote># Problematic frame:</blockquote><blockquote># C &nbsp;[libc.so.7+0xf81a6] &nbsp;memmove+0x1e</blockquote><blockquote># Core dump written. Default location: //core or core.1336</blockquote><blockquote># An error report file with more information is saved as:</blockquote><blockquote># //hs_err_pid1336.log</blockquote><blockquote># If you would like to submit a bug report, please visit:</blockquote><blockquote># &nbsp;http://bugreport.sun.com/bugreport/crash.jsp</blockquote><blockquote># The crash happened outside the Java Virtual Machine in native code.</blockquote></code><blockquote><code># See problematic frame for where to report the bug.</code></blockquote></blockquote><br>Meh... I'm not too interested in troubleshooting this. I may play a bit with JDK1.6 later and see how it jives with Confluence 5 on FreeBSD.</span><br><span style="font-size: 14px;>&lt;!--br class=" codelinebreak"--=""><br></span><br>
]]>
</description>
<link>https://ameblo.jp/shussekaido/entry-11480681077.html</link>
<pubDate>Thu, 28 Feb 2013 21:58:08 +0900</pubDate>
</item>
</channel>
</rss>
