WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: makoserver installation process  (Read 3011 times)

Offline pascati

  • Newbie
  • *
  • Posts: 3
makoserver installation process
« on: March 26, 2016, 05:23:36 PM »
Trying to run makoserver on restart on the raspberry pi 1 running piCore. I can run it manually by following the steps: (mako files were downloaded to the folder 'download') Steps are explained here: https://makoserver.net/download/raspberry-pi/
1. cd mnt/mmcblk0p2/tce/download
2. sudo cp mako mako.zip  /usr/bin/
3. sudo mako -l::site (where site is the folder i store the files in)
4. now i can navigate to the home page on port 80

So far so good, but i have to do these steps every time i restart. So i followed and searched for a day and trying to manage that bootloader/bootcode/onboot.sh/corebook... etc... but i just don't seem to manage this. Yes, i'm not too familiar with linux, i'm a c programmer :-)

This is what i found out so far, most likely completely of trace:

I have to press F2 while booting the Pi, but that doesn't do anything, it just would boot like always. I don't see any option to change the operation mode to "mount mode" instead of "cloud/internet".

Found also that i have to mount mmcblk0p2 ; edit the cmdline.txt so that the home directory is set to mmcblk0p2; in that file i also fine tce=RAM and tried to change it also to mmcblk0p2

I understood that the "onboot.lst" should not contain any shell scripts but the file opt/bootlocal.sh can have these scripts. So i thought i had to specify here that mako initialisation script but it get lost after reboot.

Tried to add the mako script from the above steps 1-4 (against better will) in the onboot.lst since these changes are kept but that doesn't work :-)

I wouldn't post this if i hadn't tried everything i could, so what am i overlooking? :-/

FYI this is what i think would have to be added in that onbootlocal.sh :
Code: [Select]
sudo cp mnt/mmcblk0p2/tce/download/mako usr/bin/
sudo cp mnt/mmcblk0p2/tce/download/mako.zip usr/bin/
sudo mako -l::site

Is there a guide how to add a startup script on boot?
greatly appreciated any hint, thanks!

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: makoserver installation process
« Reply #1 on: March 26, 2016, 08:23:54 PM »
hi pascati,

I think you need to make a "mako" extension, if one does not already exist, so it reloads on boot.

You can fudge something with /opt/.filetool.lst.

Look up extensions and persistence in the http://tinycorelinux.net/book.html

regards
Greg






Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: makoserver installation process
« Reply #2 on: March 27, 2016, 12:43:34 AM »
Looks like mako is just one binary?

Easy way is to copy to /home/tc, make it executable and run it from bootlocal.sh
Making a Mako.tcz would not be too hard and would boot faster.

It looks like an interesting IoT server solution.
HTML5, Sockets and Lua.
It would be a step up from busybox-httpd and cgi.

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: makoserver installation process
« Reply #3 on: March 27, 2016, 02:20:19 AM »
mako sort of working from /home/tc
interesting way of zipping the webpage.

got message
failed: enoent

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: makoserver installation process
« Reply #4 on: March 27, 2016, 02:44:11 AM »
Side track.

Have not played with micropython for a while.
http://forum.micropython.org/viewtopic.php?t=1033

Looks like it has usocket
http://forum.micropython.org/viewtopic.php?t=1033
As micropython comes already installed it will be interesting to try it as a webserver.

Offline pascati

  • Newbie
  • *
  • Posts: 3
Re: makoserver installation process
« Reply #5 on: March 29, 2016, 04:30:01 PM »
Guys, thanks for the good suggestions. I tried to follow them precisely however not succeeding. [shamed]

What i start with is
* expand the size of mmcblk0p2 and label it with data. (reboot for changes to take effect)
* mount mnt/mmcblk0p1 and edit the cmdline.txt (this is not explained in any wiki / cookbook / help file but i presume it's this file i need to edit? i just grepped for "tce=" ): this is in it:
c_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed tce=LABEL=data showapps pause
(+reboot)
* trying to create the extension following the steps in chapter 15. Downloading the compiletc.tcz fails, running tce-load compile-essentials.tcz seems to succeed. Page 15 tells me to run the command ./configure but it doesn't find it. ncurses.tcz is installed.
* sudo make DESTDIR=/tmp/destless install  :  no rule to make target 'isntall'
* tried then to create a personal data extension (page 14) Installation of the squashfs succeeded but using the mksquashfs gives
/usr/local/bin/mksquashfs: line 1: syntax error: unexpected word (expecting ")")

So i seem to be running form one issue in to another one.

What is it that i'm doing so wrong? youtube movies seem to be using virtual box ratter than raspberrypi, perhaps that's what makes it different?

Would it be an option if someone looks over my shoulders, might take experienced guys 5 minutes to perform that action and i'm settled to start with the makoserver. I don't want to install it on a linux pc and looks like tinycore is the ideal solution. I'm willing to finance this operation :-)
Summary: installing makoserver and running it is OK. Since after the reboot all is lost i'm trying to "install" this so i don't have to worry about all the linux difficulties again. [getting desperate]

 

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: makoserver installation process
« Reply #6 on: March 29, 2016, 09:08:58 PM »
Hi Pascati,

On the normal piCore openssh version there is about 3MB left, this is plenty to install the mako binary.
I just filezilla it into /home/tc directory
You then start it by adding it to /opt/bootsync.sh
fieltool.sh -b will backup piCore.

For web server stuff I use gparted on a Linux box to make a third partition for the data.
Sometime this partition mmcblk0p3 may need to be symbolic linked.

I use busybox-httpd web server at the moment with html files etc in /home/tc/www.
Read the Corebook ch 22 page 103
It is not entirely correct for piCore, I use this in bootsync.sh
/use/local/sbin/busybox-httpd start -h /home/tc/www -u tc:staff

Gavin

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: makoserver installation process
« Reply #7 on: March 30, 2016, 01:32:21 AM »

* expand the size of mmcblk0p2 and label it with data. (reboot for changes to take effect)


Adding label to mmcblk0p2 is not necessary, however it doesn't harm.


* mount mnt/mmcblk0p1 and edit the cmdline.txt (this is not explained in any wiki / cookbook / help file but i presume it's this file i need to edit? i just grepped for "tce=" ): this is in it:
c_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed tce=LABEL=data showapps pause
(+reboot)


Except very special cases no need to change cmdline.txt at all. TC (and piCore) search for /tce direcory on available ext/fat partitions during startup and will use first /tce found, which is /mnt/mmcblk0p2/tce in our case. Your changes do not affect operation, so kindly advice to drop them and leave system as it was before.

Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: makoserver installation process
« Reply #8 on: March 30, 2016, 01:36:21 AM »
As far as I see you are using piCore 6.x Kindly advice to move to 7.1beta3.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline pascati

  • Newbie
  • *
  • Posts: 3
Re: makoserver installation process
« Reply #9 on: March 30, 2016, 11:27:53 AM »
OK guys, finally made it :-)
The tip from Gavin did the trick and got it all sorted out. Just 1 minor change to use the bootlocal.sh instead of bootsync.sh.
I used the piCore 7.1beta3 as suggested by Béla.
Thanks a million everybody for this great piCore team and forum support!

These were my notes in the final installation process, might be interesting for dummies like me to get it running:

Installation process makoserver on the piCore distro (PI1)
hardware:
  • SD card Scandisk 32Gb 30MB/s
  • Raspberrypi 1
  • a mac

on my MAC:
Download the latest image from
http://tinycorelinux.net/7.x/armv6/releases/RPi/

format the SD card (FAT) note the disknumber found in menu:mac/about this mac: system report/USB; for me it was disk1 (not rdisk1)
In diskutility: unmount the SD card
in a terminal window:
Code: [Select]
sudo dd if=piCore-x.x.img of=/dev/NAME_OF_SDCARD && syncEject the card.

insert the sd card in the pi; open a terminal on the mac:
Code: [Select]
ssh tc@IP_ADDRESS to start a ssh session with the PI. IP address is the one form the raspberry pi, use lanscan on mac or fing on iphone to find the IP.
Every reboot i did get a warning (man in the middle attack) due to the mac's security settings and had to remove the IP and key from
Code: [Select]
vi /Users/USER_NAME/.ssh/known_hostsselect the line showing the PI's IP address and press "dd" then ":wq"
enter the passw piCore when asked.

Now follow the steps 1-4 found in the readme file that came along with the piCore img downloaded, chapter SD card partitioning to partition and resize the workable storage.

after the reboot, make an ssh connection to the PI. Installing now the makoserver, instructions from https://makoserver.net/download/raspberry-pi/
Code: [Select]
cd home/tc/
Code: [Select]
wget http://makoserver.net/download/mako.raspberrypi.tar.gzUnzip by running the command
Code: [Select]
tar xvzf mako.raspberrypi.tar.gzand remove the gz file after unzipping:
Code: [Select]
rm mako.raspberrypi.tar.gzyou'll end up with these files:
LICENSE.txt  README.txt   mako         mako.zip     rundemo.sh   tutorial/

I created a folder on partition2 to store the webpages:
Code: [Select]
mkdir /mnt/mmcblk0p2/SITE
Now it's time to make the makoserver to start on reboot: (thank you Gaving)
Code: [Select]
vi /opt/bootlocal.shand add this line:
/home/tc/mako -l::/mnt/mmcblk0p2/SITE
below:
# ------ Put other system startup commands below this line
note i didn't add it to the bootsync.sh since it would start and wait untill done, breaking the command "sudo reboot" and also locking (you can type text but no action) the local keyboard connected to the PI.

last step to make sure we save the changes for booting:
Code: [Select]
filetool.sh -bshowing => Backing up files to /mnt/mmcblk0p2/tce/mydata.tgz
Reboot the device
Code: [Select]
sudo reboot
To test the server, i created a file in the SITE folder "index.lsp" containing hello world:
Code: [Select]
vi /mnt/mmcblk0p2/SITE/index.lsptype "i" to insert the text "hello world" + ESC + ":wq" to save and quit.
Navigating form the mac to the IP of PI should show you the hello world page.

Thanks for everybody (speccially Gavin) for the instructive posts. It has been a steep learning curve to me :-) haha