diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..36ea98c --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Ignore the .vagrant folder +.vagrant + +#Ignore all cloned repos/folders +*/ + +#Dont ignore the html folder/readme or vagrant config files +!/html +!/vagrantConfig diff --git a/README.md b/README.md index d357673..a8da960 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# coffeemaker +# CoffeeMaker + +![CofeeMaker Vagrant .gif](https://cloud.githubusercontent.com/assets/1448289/15005253/e4156dce-1176-11e6-84a6-8aff8439ee97.gif) + Vagrant Box with all tools needed to work on C&&C projects + +This includes tools such as NodeJS, NPM, Ruby, and Jekyll diff --git a/Vagrantfile b/Vagrantfile index 4c71c94..70d7691 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,3 +1,16 @@ Vagrant.configure(2) do |config| + + #Define the ubuntu box config.vm.box = "ubuntu/trusty64" + + # Name the Vagrant instance + config.vm.define "CodeAndCoffeeVagrant" + + # Forward our ports + # 80 for apache, 4000 for jekyll + config.vm.network "forwarded_port", guest: 80, host: 8080 + config.vm.network "forwarded_port", guest: 4000, host: 4000 + + # Run bootstrap script + config.vm.provision :shell, path: "bootstrap.sh", privileged: false end diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..87926d5 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,110 @@ +#!/usr/bin/env bash + +#Welcome the user +echo "Welcome to the Code And Coffee Long Beach vagrant!" +echo "We are now provisioning the vagrant box..." + +#Remove Non-interactive .bashrc lines +echo "Modifying .bashrc to allow edits" +sed '5,10d;' /home/vagrant/.bashrc > /home/vagrant/.bashrcNew +mv /home/vagrant/.bashrcNew /home/vagrant/.bashrc + +#Update The Distro +sudo apt-get update + +#Download things for Npm and Ruby(Compass and things) +sudo apt-get install -y git build-essential libssl-dev git-core curl zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev vim apache2 + +#Install apache2 + +# Replace apache dir.conf, enable apache php +sudo cp /vagrant/vagrantConfig/dir.conf /etc/apache2/mods-enabled/dir.conf + +#Restart apache +sudo service apache2 restart + +#Set our document root so we can access it +sudo cp /vagrant/vagrantConfig/000-default.conf /etc/apache2/sites-available/000-default.conf + +#Restart apache +sudo service apache2 restart + +#Allow .htaccess overrides +sudo cp /vagrant/vagrantConfig/apache2.conf /etc/apache2/apache2.conf +sudo a2enmod rewrite +sudo apache2ctl configtest + +#Own the html directory by www-data +sudo chown -R vagrant:www-data /vagrant/html +sudo chmod -R 755 /vagrant/html + +#Restart apache for the permissions change +sudo service apache2 restart + +#Install NVM (Node Version Manager) +curl https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | sh +source /home/vagrant/.bashrc + +#Install Node (Latest LTS on 4/23/16) +nvm install 4.4.3 +nvm use 4.4.3 +node -v +nvm alias default 4.4.3 + +#Install npm without sudo +curl https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh | sh < /vagrant/npmNoSudoInput.txt +source /home/vagrant/.bashrc + +#Install RbEnv +cd +git clone git://github.com/sstephenson/rbenv.git .rbenv +echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc +echo 'eval "$(rbenv init -)"' >> ~/.bashrc +git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build +echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc +source /home/vagrant/.bashrc + +#Use RBEnv To install Ruby (Latest on 4/23/16) +rbenv install -v 2.3.0 +rbenv global 2.3.0 + +#ensure it installed +ruby -v + +#ruby gem tweaking +echo "gem: --no-document" > ~/.gemrc +gem install bundler + +#Install Rails +gem install rails +rbenv rehash +rails -v + +#INstall compass +gem install compass +rbenv rehash + +#Install Jekyll +gem install jekyll +rbenv rehash + +#Install Bundler +gem install bundle +rbenv rehash + +#Update npm, Install grunt and bower with npm +npm install -g npm +npm install --global bower grunt-cli +bower --version +grunt --version + +#Add our awesome ubuntu banner +sudo cp /vagrant/vagrantConfig/sshd_config /etc/ssh/sshd_config +sudo cp /vagrant/vagrantConfig/issue.net /etc/issue.net +sudo cp /vagrant/vagrantConfig/issue.net /etc/motd + +#Finished! + +#Salutations to the user +echo "Thank you for using the Code And Coffee Long Beach Vagrant!" +echo "Have a nice day!" diff --git a/html/README.md b/html/README.md new file mode 100755 index 0000000..f6b86d8 --- /dev/null +++ b/html/README.md @@ -0,0 +1,3 @@ +# This folder is used by apache + +Place your projects/files you would like apache to serve here diff --git a/vagrantConfig/000-default.conf b/vagrantConfig/000-default.conf new file mode 100644 index 0000000..d764e69 --- /dev/null +++ b/vagrantConfig/000-default.conf @@ -0,0 +1,31 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin webmaster@localhost + DocumentRoot /vagrant/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/vagrantConfig/README.md b/vagrantConfig/README.md new file mode 100644 index 0000000..f37f75e --- /dev/null +++ b/vagrantConfig/README.md @@ -0,0 +1,5 @@ +# This folder is used by Vagrant for provisioning + +Here you will find files that are preconfigured to work with the code and coffee vagrant, + +Such as apache files, as well as some files to enable the ssh banner diff --git a/vagrantConfig/apache2.conf b/vagrantConfig/apache2.conf new file mode 100644 index 0000000..e7707d8 --- /dev/null +++ b/vagrantConfig/apache2.conf @@ -0,0 +1,227 @@ +# This is the main Apache server configuration file. It contains the +# configuration directives that give the server its instructions. +# See http://httpd.apache.org/docs/2.4/ for detailed information about +# the directives and /usr/share/doc/apache2/README.Debian about Debian specific +# hints. +# +# +# Summary of how the Apache 2 configuration works in Debian: +# The Apache 2 web server configuration in Debian is quite different to +# upstream's suggested way to configure the web server. This is because Debian's +# default Apache2 installation attempts to make adding and removing modules, +# virtual hosts, and extra configuration directives as flexible as possible, in +# order to make automating the changes and administering the server as easy as +# possible. + +# It is split into several files forming the configuration hierarchy outlined +# below, all located in the /etc/apache2/ directory: +# +# /etc/apache2/ +# |-- apache2.conf +# | `-- ports.conf +# |-- mods-enabled +# | |-- *.load +# | `-- *.conf +# |-- conf-enabled +# | `-- *.conf +# `-- sites-enabled +# `-- *.conf +# +# +# * apache2.conf is the main configuration file (this file). It puts the pieces +# together by including all remaining configuration files when starting up the +# web server. +# +# * ports.conf is always included from the main configuration file. It is +# supposed to determine listening ports for incoming connections which can be +# customized anytime. +# +# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ +# directories contain particular configuration snippets which manage modules, +# global configuration fragments, or virtual host configurations, +# respectively. +# +# They are activated by symlinking available configuration files from their +# respective *-available/ counterparts. These should be managed by using our +# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See +# their respective man pages for detailed information. +# +# * The binary is called apache2. Due to the use of environment variables, in +# the default configuration, apache2 needs to be started/stopped with +# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not +# work with the default configuration. + + +# Global configuration +# + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# NOTE! If you intend to place this on an NFS (or otherwise network) +# mounted filesystem then please read the Mutex documentation (available +# at ); +# you will save yourself a lot of trouble. +# +# Do NOT add a slash at the end of the directory path. +# +#ServerRoot "/etc/apache2" + +# +# The accept serialization lock file MUST BE STORED ON A LOCAL DISK. +# +Mutex file:${APACHE_LOCK_DIR} default + +# +# PidFile: The file in which the server should record its process +# identification number when it starts. +# This needs to be set in /etc/apache2/envvars +# +PidFile ${APACHE_PID_FILE} + +# +# Timeout: The number of seconds before receives and sends time out. +# +Timeout 300 + +# +# KeepAlive: Whether or not to allow persistent connections (more than +# one request per connection). Set to "Off" to deactivate. +# +KeepAlive On + +# +# MaxKeepAliveRequests: The maximum number of requests to allow +# during a persistent connection. Set to 0 to allow an unlimited amount. +# We recommend you leave this number high, for maximum performance. +# +MaxKeepAliveRequests 100 + +# +# KeepAliveTimeout: Number of seconds to wait for the next request from the +# same client on the same connection. +# +KeepAliveTimeout 5 + + +# These need to be set in /etc/apache2/envvars +User ${APACHE_RUN_USER} +Group ${APACHE_RUN_GROUP} + +# +# HostnameLookups: Log the names of clients or just their IP addresses +# e.g., www.apache.org (on) or 204.62.129.132 (off). +# The default is off because it'd be overall better for the net if people +# had to knowingly turn this feature on, since enabling it means that +# each client request will result in AT LEAST one lookup request to the +# nameserver. +# +HostnameLookups Off + +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog ${APACHE_LOG_DIR}/error.log + +# +# LogLevel: Control the severity of messages logged to the error_log. +# Available values: trace8, ..., trace1, debug, info, notice, warn, +# error, crit, alert, emerg. +# It is also possible to configure the log level for particular modules, e.g. +# "LogLevel info ssl:warn" +# +LogLevel warn + +# Include module configuration: +IncludeOptional mods-enabled/*.load +IncludeOptional mods-enabled/*.conf + +# Include list of ports to listen on +Include ports.conf + + +# Sets the default security model of the Apache2 HTTPD server. It does +# not allow access to the root filesystem outside of /usr/share and /var/www. +# The former is used by web applications packaged in Debian, +# the latter may be used for local directories served by the web server. If +# your system is serving content from a sub-directory in /srv you must allow +# access here, or in any related virtual host. + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + AllowOverride None + Require all granted + + + + Options Indexes FollowSymLinks + AllowOverride None + Require all granted + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +# +# Options Indexes FollowSymLinks +# AllowOverride None +# Require all granted +# + + + + +# AccessFileName: The name of the file to look for in each directory +# for additional configuration directives. See also the AllowOverride +# directive. +# +AccessFileName .htaccess + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + + +# +# The following directives define some format nicknames for use with +# a CustomLog directive. +# +# These deviate from the Common Log Format definitions in that they use %O +# (the actual bytes sent including headers) instead of %b (the size of the +# requested file), because the latter makes it impossible to detect partial +# requests. +# +# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended. +# Use mod_remoteip instead. +# +LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined +LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %O" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent + +# Include of directories ignores editors' and dpkg's backup files, +# see README.Debian for details. + +# Include generic snippets of statements +IncludeOptional conf-enabled/*.conf + +# Include the virtual host configurations: +IncludeOptional sites-enabled/*.conf + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/vagrantConfig/dir.conf b/vagrantConfig/dir.conf new file mode 100644 index 0000000..7acce03 --- /dev/null +++ b/vagrantConfig/dir.conf @@ -0,0 +1,5 @@ + + DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/vagrantConfig/issue.net b/vagrantConfig/issue.net new file mode 100644 index 0000000..a8cf823 --- /dev/null +++ b/vagrantConfig/issue.net @@ -0,0 +1,50 @@ + +Welcome to the Code And Coffee Long Beach Vagrant Box! + + x0c. + .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MMMMMMMMMMMMMMMMMMMMd + ,WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN, + lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNc + cXWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWx. + ....................................... +.:dOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOk; + .lKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNc + 'ckXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNO, + .:xKXXXXNNNNNNNNNWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMWWWWNXK0kdc' diff --git a/vagrantConfig/npmNoSudoInput.txt b/vagrantConfig/npmNoSudoInput.txt new file mode 100644 index 0000000..8cb8bae --- /dev/null +++ b/vagrantConfig/npmNoSudoInput.txt @@ -0,0 +1,2 @@ + +y diff --git a/vagrantConfig/sshd_config b/vagrantConfig/sshd_config new file mode 100644 index 0000000..35536aa --- /dev/null +++ b/vagrantConfig/sshd_config @@ -0,0 +1,88 @@ +# Package generated configuration file +# See the sshd_config(5) manpage for details + +# What ports, IPs and protocols we listen for +Port 22 +# Use these options to restrict which interfaces/protocols sshd will bind to +#ListenAddress :: +#ListenAddress 0.0.0.0 +Protocol 2 +# HostKeys for protocol version 2 +HostKey /etc/ssh/ssh_host_rsa_key +HostKey /etc/ssh/ssh_host_dsa_key +HostKey /etc/ssh/ssh_host_ecdsa_key +HostKey /etc/ssh/ssh_host_ed25519_key +#Privilege Separation is turned on for security +UsePrivilegeSeparation yes + +# Lifetime and size of ephemeral version 1 server key +KeyRegenerationInterval 3600 +ServerKeyBits 1024 + +# Logging +SyslogFacility AUTH +LogLevel INFO + +# Authentication: +LoginGraceTime 120 +PermitRootLogin without-password +StrictModes yes + +RSAAuthentication yes +PubkeyAuthentication yes +#AuthorizedKeysFile %h/.ssh/authorized_keys + +# Don't read the user's ~/.rhosts and ~/.shosts files +IgnoreRhosts yes +# For this to work you will also need host keys in /etc/ssh_known_hosts +RhostsRSAAuthentication no +# similar for protocol version 2 +HostbasedAuthentication no +# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication +#IgnoreUserKnownHosts yes + +# To enable empty passwords, change to yes (NOT RECOMMENDED) +PermitEmptyPasswords no + +# Change to yes to enable challenge-response passwords (beware issues with +# some PAM modules and threads) +ChallengeResponseAuthentication no + +# Change to no to disable tunnelled clear text passwords +PasswordAuthentication yes + +# Kerberos options +#KerberosAuthentication no +#KerberosGetAFSToken no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes + +# GSSAPI options +#GSSAPIAuthentication no +#GSSAPICleanupCredentials yes + +X11Forwarding yes +X11DisplayOffset 10 +PrintMotd no +PrintLastLog yes +TCPKeepAlive yes +#UseLogin no + +#MaxStartups 10:30:60 +Banner /etc/issue.net + +# Allow client to pass locale environment variables +AcceptEnv LANG LC_* + +Subsystem sftp /usr/lib/openssh/sftp-server + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the ChallengeResponseAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via ChallengeResponseAuthentication may bypass +# the setting of "PermitRootLogin without-password". +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and ChallengeResponseAuthentication to 'no'. +UsePAM yes