Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Jun 06, 2015 11:44 am 
Offline
Senior Member
User avatar

Joined: Thu Jul 12, 2012 3:55 pm
Posts: 133
Website: http://www.amitywebsolutions.co.uk
Is it possible to deploy an image using stackscripts? Rather than have a stackscript to setup a server from scratch, I have an image I use for this. But once the image is deployed, I still have further work to do via the command line, so I wondered if I can automate this, and the only way I can think of is using a stackcript to deploy the image which I can then add the further commands to which run automatically.

Thanks

_________________
Web Development Agency in South Wales


Top
   
PostPosted: Sun Jun 07, 2015 8:03 am 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
I would first try to automate everything in a single stackscript.

If this is not possible and you really need to use an image that you prepared, maybe this would work: Create three disks:

/dev/xvda minimalroot
/dev/xvdb swap
/dev/xvdc newroot

Then you can deploy a system to /dev/xvda and write a stackscript which formats /dev/xvdc, retrieves a suitable tar.gz that you have prepared, and unpacks it in /dev/xvdc. Then you can change the build profile so that it boots from /dev/xvdc, or you could use pv-grub and modify the menu so that it boots to /dev/xvdc the next time.


Top
   
PostPosted: Mon Jun 08, 2015 8:12 am 
Offline
Senior Member
User avatar

Joined: Thu Jul 12, 2012 3:55 pm
Posts: 133
Website: http://www.amitywebsolutions.co.uk
thanks sanvilla, a bit more involved than I hoped, but maybe possible.

I didnt want to use a stackscript because its installing everything from scratch it takes AGES, whereas restoring an image takes a few minutes. I am thinking of keeping a bash script on the image server that has the commands I want to run and then just manually running that after first boot. There is probably a way I could set it run this script automatically on first boot anyway, although I will occasionally deploy this image to run updates to create a new image, so just need to remember to set it back to run this script again the next time it boots.

Thanks

_________________
Web Development Agency in South Wales


Top
   
PostPosted: Tue Jun 09, 2015 3:06 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
In the image, you could create a file in /etc/cron.d/ with something like:
Code:
@reboot    root    /path/to/script


The @reboot will cause the job to be run whenever cron is started (doesn't necessarily have to be a reboot of the machine). Depending on what the script does, you might need to put in some logic so it doesn't get run more than once (e.g., it could delete the entry from /etc/cron.d/ when its tasks have completed successfully).


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group