puppet install non forge module - puppet

I'm fairly new to puppet and I want to install a puppet module not using the puppet forge.
I have a page similar to the puppet forge where I keep my modules. I have 2 instances one is a Linux server so I can ssh into, and one is can work from remotely.
I have used git clone to make a branch, and I have copied the module i want into a folder inside that branch. How do I install the module into my Linux server?
When I ssh into my linux instance I get this message
puppet module list --tree
/opt/puppet/share/puppet/modules (no modules installed)

If you want to write your own modules and then use them on your own servers,
follow the guidelines in https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html
In particular the puppet module generate is good for getting started with a skeleton. Use the files in the skeleton (Modulefile, manifests etc) to build a tar ball then refer to https://docs.puppetlabs.com/puppet/latest/reference/modules_installing.html#installing-from-a-release-tarball to install the tarball

Related

How to properly build package from sources

I'm using ubuntu 18.04.
I want to modify and build a project and install it as a package. For example gstreamer1.5.
So I clone repo, modify code and use ./autogen.sh and make install in project folder. Why don't I see it in apt list then? Also there is no files in /usr/lib/x86_64-linux-gnu/gstreamer-1.5/.
The reason why I want it to behave as the original package is becase I want to build another project that uses it (kurento media server). So I just want to remove some plugins I don't need that use another packages as deps I cannot use.
apt list is from the Linux distribution. You custom made things won't appear there magically.
If you make install from your custom tree your libraries and plugins will land in /usr/local/lib/.. (note the local path). You may have some control over it by setting the prefix path. Just be careful you don't break you system by overwriting with broken libraries.

Installing Node in a linux grid server

So some background, I'm installing Node on a host server, but it's a grid server not a server that's solely for my website.
The grid server doesn't have a root user/ administrative powers. So to install node I found this workaround: http://iantearle.com/blog/media-temple-grid-and-nodejs . It's a Linux Grid server, I've never used Linux so if someone could explain to me what the commands mean, especially: ./configure --prefix=~/opt/
Lastly I followed the steps but when I try to run the node command in the server it says node:command not found - which is why I'm trying to understand the steps. Thanks
To explain the process:
Configure
The configure script is responsible for getting ready to build the software on your specific system. It makes sure all of the dependencies for the rest of the build and install process are available, and finds out whatever it needs to know to use those dependencies.
Unix programs are often written in C, so we’ll usually need a C compiler to build them. In these cases the configure script will establish that your system does indeed have a C compiler, and find out what it’s called and where to find it.
Make
Once configure has done its job, we can invoke make to build the software. This runs a series of tasks defined in a Makefile to build the finished program from its source code.
The tarball you download usually doesn’t include a finished Makefile. Instead it comes with a template called Makefile.in and the configure script produces a customised Makefile specific to your system.
3.Make Install
Now that the software is built and ready to run, the files can be copied to their final destinations. The make install command will copy the built program, and its libraries and documentation, to the correct locations.
--prefix=~/opt/ -> will set the build directory to /home/yourhome/opt directory.
Now if you didnt get errors while doing those 3 steps explained above make sure you did the following:
nano ~/.bash_profile
export PATH=~/opt/bin:${PATH}
nano is a text editor and you are opening .bash_profile file with it.
you need to add export PATH=~/opt/bin:${PATH} in that file and save it using ctrl+x
Then restart your terminal.
Specified github repository for nodejs is outdated. use the following link instead.
git clone https://github.com/nodejs/node.git
P.S node:command not found usually happens when the program is not installed correctly or it's executable isnt in your terminal's PATH variable.

installing a 3rd party module on a puppet agent

We have a puppetmaster and an agent machine I'm configuring from it, via the puppet agent -t command.
On this agent machine (an Ubuntu box) I need the bc (base calculator) command installed when it's built. Right now that's not the case.
There appears to be a module for it on the forge (https://forge.puppetlabs.com/rfletcher/bc/readme) but I'm fairly new to puppet and am not sure how to set things up so that when the Ubuntu box is spun up this module is installed?
I'm going over the agent docs but am still learning about how agents communicate with puppetmasters. I'm hoping for a nudge on what to do to make sure this command is installed on my agent when all is said and done (stick something in a manifest somewhere most likely?)
So you are asking how to use forge modules in puppet. My first suggestion is, read the relative documents as more as possible, all in Puppet Forge
If you need get quick start, here are something you can try.
login puppet master
cd to puppet module folder
puppet module install rfletcher-bc
mv rfletcher-bc bc
then find the node pp file (normally it should be init.pp) to add below line:
include bc
I didn't have your environment, and not sure which pp file will be targeted.

How to use puppet to install and configure custom app?

My goal is for my users to start with a base Linux machine, install puppet, clone my GitHub repo and run puppet apply myapp.pp, this should then using puppet:
1) configure the system with any pre-requisites etc,
2) git clone another repo that contains my application code
3) compile, install and configure my application.
The specifics of getting Puppet to do 1, 2 and 3 seem fairly straight-forward, but what I cannot understand is if I should write a Puppet Module, or just a Manifest?
I started with a Manifest, but templating did not seem to work, puppet always complained it could not find the .erb files. That work can be seen here: https://github.com/adamretter/exist-puppet.
After making some enquiries, I was told that I needed to refactor my code into a Puppet module, which I have started to do here: https://github.com/adamretter/puppet-exist.
However there seems to be no way to run puppet apply on a module, so how do I achieve what I am looking for? Someone said that I need to call my module from a small .pp file stub, but I cannot see how to do that in the same git repo, as when I try to include it, it says it cannot find my module?
Are there any good examples where this is kinda thing is already done?
I have tried to follow the Puppet documentation, but it seems to make leaps or assume too much: https://docs.puppetlabs.com/guides/module_guides/bgtm.html
First of all, post your errors when you run a command, that will help debug the problem. Here are a few tips you can follow:
To apply a standalone module, you need to have the following structure :
<modulename>/manifests/init.pp
/<subname>.pp
init.pp content may look like this :
class <modulename> {
notify {"New module using Puppet apply":}
include <modulename>::<subname>
}
subname.pp content may look like this :
class <modulename>::<subname> {
# Some manifest
}
All these files need to be physically on the client machine in order for puppet apply to work. And you need to be in the parent directory of <modulename> while running puppet apply command. You can do,
puppet apply -e 'include <modulename>'
As #FelixFrank suggested, you can give the modulepath as an argument.
puppet apply -e 'include <modulename>' --modulepath=/path/to/modules

How do I deploy Node.js applications as a single executable file? [duplicate]

This question already has answers here:
How to make exe files from a node.js app?
(20 answers)
Closed 7 years ago.
Supposed I have written a Node.js application, and I now would like to distribute it. Of course, I want to make it easy for the user, hence I do not want him to install Node.js, run npm install and then manually type node app.js.
What I'd prefer was a single executable file, e.g. an .exe file on Windows.
How could I approach this?
I am aware of this thread, anyway this is only about Windows. How could I achieve this in a platform-independent manner? Any ideas? Best practices? ...?
The perfect solution was a "compiler" I can give a source folder to. The source folder contains the app itself in various .js files, the node_modules folder and some metadata, such as the package.json. The output should be binaries for various platforms, such as Windows, OS X and Linux.
Oh, and what's important: I do not want to make any changes to the source code, so calls to require with relative paths should still work, even if this relative path is now inside the packaged app.
Any ideas?
PS: I do not want the user to install Node.js independently, it should be included inside the executable as well.
Meanwhile I have found the (for me) perfect solution: nexe, which creates a single executable from a Node.js application including all of its modules.
It's the next best thing to an ideal solution.
First, we're talking about packaging a Node.js app for workshops, demos, etc. where it can be handy to have an app "just running" without the need for the end user to care about installation and dependencies.
You can try the following setup:
Get your apps source code
npm install all dependencies (via package.json) to the local node_modules directory. It is important to perform this step on each platform you want to support separately, in case of binary dependencies.
Copy the Node.js binary – node.exe on Windows, (probably) /usr/local/bin/node on OS X/Linux to your project's root folder. On OS X/Linux you can find the location of the Node.js binary with which node.
For Windows:
Create a self extracting archive, 7zip_extra supports a way to execute a command right after extraction, see: http://www.msfn.org/board/topic/39048-how-to-make-a-7-zip-switchless-installer/.
For OS X/Linux:
You can use tools like makeself or unzipsfx (I don't know if this is compiled with CHEAP_SFX_AUTORUN defined by default).
These tools will extract the archive to a temporary directory, execute the given command (e.g. node app.js) and remove all files when finished.
Not to beat a dead horse, but the solution you're describing sounds a lot like Node-Webkit.
From the Git Page:
node-webkit is an app runtime based on Chromium and node.js. You can write native apps in HTML and JavaScript with node-webkit. It also lets you call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.
These instructions specifically detail the creation of a single file app that a user can execute, and this portion describes the external dependencies.
I'm not sure if it's the exact solution, but it seems pretty close.
Hope it helps!
JXcore will allow you to turn any nodejs application into a single executable, including all dependencies, in either Windows, Linux, or Mac OS X.
Here is a link to the installer:
https://github.com/jxcore/jxcore-release
And here is a link to how to set it up:
http://jxcore.com/turn-node-applications-into-executables/
It is very easy to use and I have tested it in both Windows 8.1 and Ubuntu 14.04.
FYI: JXcore is a fork of NodeJS so it is 100% NodeJS compatible, with some extra features.
In addition to nexe, browserify can be used to bundle up all your dependencies as a single .js file. This does not bundle the actual node executable, just handles the javascript side. It too does not handle native modules. The command line options for pure node compilation would be browserify --output bundle.js --bare --dg false input.js.
There are a number of steps you have to go through to create an installer and it varies for each Operating System. For Example:
on Mac OS X you need to create a .pkg, there are instructions on how to do that here: https://coolaj86.com/articles/how-to-create-an-osx-pkg-installer.html
on Ubuntu Linux you need to create a .deb, there are instruction on how to do that here: https://coolaj86.com/articles/how-to-create-a-debian-installer.html
on Microsoft Windows you need to create a .exe or .msi, there are instruction on how do that using the innosetup installer here: https://coolaj86.com/articles/how-to-create-an-innosetup-installer.html
You could create a git repo and setup a link to the node git repo as a dependency. Then any user who clones the repo could also install node.
#git submodule [--quiet] add [-b branch] [-f|--force]
git submodule add /var/Node-repo.git common
You could easily package a script up to automatically clone the git repo you have hosted somewhere and "install" from one that one script file.
#!/bin/sh
#clone git repo
git clone your-repo.git

Resources