Difference between pages "Creating Profiles" and "Web-server-stack"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
m (Drobbins moved page Custom Profiles to Creating Profiles)
 
 
Line 1: Line 1:
Want to create your own custom profiles? Thought up a mix-in that's not currently in the Funtoo profiles? Have an overlay with profiles and want to make it easy for people to use them? Well you've come to the right place. This article will show you how to easily add you own profiles. No more ugly hacking of parent files and other nonsense. Once you follow this guide, not only will portage easily recognize your profiles, they will also show up in eselect right along with the ones from the main tree.


== How to do it ==
== Pre-install considerations ==
=== Rules to follow ===
=== ssl ===
#You will need a version of [[Package:Eselect|eselect]] that supports Funtoo profiles (already integrated into Funtoo Linux.)
Ssl [http://en.wikipedia.org/wiki/Wildcard_certificate wild card certificates] can use the same certificate to cover several subdomain names. As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate.  https://funtoo.org would not be covered under the wildcard, so [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) suggests using http://domain.tld as a http navigation splash page directory.  All that is required to setup a ca signed ssl certificate is an email on the server.  https://www.startssl.com offers free ssl ca certificates, though there are several other certificate [http://en.wikipedia.org/wiki/Certificate_authority#Providers providers]. Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https://
#Your overlay must have a profiles directory. It must include a repo_name file with the name of your overlay.  
#Your profiles must be inside of the profiles directory
#You need a profiles.eselect.desc file inside the profiles directory. See profiles.eselect.example in your Funtoo Portage tree for instructions.
#If you're creating profiles of types arch, build, flavor, or mix-ins, your profile must be inside a directory with same name, such as <tt>profiles/my_profile/flavor/new_profile</tt>, <tt>profiles/my_profile/mix-ins/subdir/profile</tt>.
# Currently <tt>NoMix</tt> (see <tt>profiles.eselect.example</tt>) is only supported for profiles in the same tree.
# If you're not using a standard Funtoo tree, you must ensure that your main Portage tree has <tt>profile-formats = portage-2</tt> set in <tt>metadata/layout.conf</tt> in order for portage to interpret the <repo_name>:<profile> syntax.


=== Example of how to set up ===
=== sockets vs tcp stack ===
For our example we will create a mix-ins profile called 'fake_pro' in a local overlay called 'local_overlay'. fake_pro will set the 'dummy' USE flag globally and also set the 'fake' USE flag on sys-apps/not-exist. We will then add the profile to eselect so it's visible when running 'eselect profile'.
Sockets have less overhead but can not be shared across jails, or to other machines. Tcp stack has more overhead but is far more flexible.


==== Creating the profile ====
=== Email Servers ===
We will use ''<code>${OVERLAY_DIR}</code>'' as the path to local_overlay. These instructions assume the overlay exists.
* {{Package|mail-mta/postfix}<-- suggested
If you haven't set a name for your overlay, do that first:
* {{Package|mail-mta/ssmtp}}
<console>
* {{Package|mail-mta/exim}}
###i## echo "local_overlay" > ${OVERLAY_DIR}/profiles/repo_name
* {{Package|mail-mta/sendmail}}
</console>
* {{Package|mail-mta/nullmailer}}


Next lets create a directory to store our profile. Since we're creating a 'mix-ins' profile we need to make sure our profile is inside a 'mix-ins' subdirectory. This is a requirement in order to ensure that the profile will show up in eselect. If your not planning on using eselect then there's no requirement to use 'mix-ins'
=== FTP Servers ===
<console>
It is common practice to use FTP servers to host files for downloading.
###i## install -d ${OVERLAY_DIR}/profiles/my_profiles/mix-ins/fake_pro
</console>


Now that we have a directory for our profile, lets go ahead and add our settings. Global USE settings go in ''<code>make.defaults</code>'', package specific USE settings go in ''<code>package.use</code>'':
* {{Package|net-ftp/vsftpd}} <-- suggested
<console>
* {{Package|net-ftp/proftpd}}
###i## cd ${OVERLAY_DIR}/profiles/my_profiles/mix-ins/fake_pro
* {{Package|net-ftp/pure-ftpd}}
###i## echo 'USE="$USE dummy"' >> make.defaults
* {{Package|net-ftp/qshare}}
###i## echo 'sys-apps/not-exist fake' >> package.use
</console>
Note that no matter if your using funtoo or gentoo, profile settings all work the same. For more information please check the portage man page.


==== Adding to eselect ====
== Webserver ==
eselect reads from the file ''<code>profiles.eselect.desc</code>'' in your profiles/ directory. Format is "Type Name Status NoMix" space-separated. For more information look in ''<code>/usr/portage/profiles/profiles.eselect.example</code>'':
Web servers come in several varieties. The most common stack is known as LAMP which stands for linux apache mysql php. [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.
<console>
###i## echo 'mix-ins my_profiles/mix-ins/fake_pro testing' >> ${OVERLAY_DIR}/profiles/profiles.eselect.desc
</console>
Watch the result:
<console>
###i## eselect profile list
</console>


[[Category:Portage]]
=== Databases ===
[[Category:Labs]]
* {{Package|dev-db/mysql}}
[[Category:HOWTO]]
 
[[Category:Featured]]
mariadb is a drop in replacement for mysql
* {{Package|dev-db/mariadb}} <-- suggested
 
percona is a drop in replacement for mysql
* {{Package|dev-db/percona-server}}
 
* {{Package|dev-db/postgresql-server}}
* {{Package|dev-db/sqlite}}
 
=== Languages ===
* {{Package|dev-lang/php}} <-- suggested
* {{Package|dev-lang/perl}}
* {{Package|dev-lang/python}}
 
=== Web Servers ===
* {{Package|www-servers/apache}}
* {{Package|www-servers/cherokee}}
* {{Package|www-servers/nginx}} <-- suggested
* {{Package|www-servers/tengine}}
* {{Package|www-servers/lighttpd}}
 
 
=== SSL Termination, Reverse Proxies, & load balancing ===
Reverse proxies are useful, some cache static data, and shuck out cached pages rather than hitting the web server.  Some pass requests to backend nodes high availability clustering your website, some web servers have this functionality built in.
 
* {{Package|www-servers/nginx}}
* {{package|net-misc/stunnel}}
* {{package|www-servers/pound}} <-- suggested for ssl termination & load balancing
* {{Package|www-servers/varnish}} <-- suggested for caching to reduce power consumption & reduce the need of constantly rebuilding pages
* {{Package|net-proxy/squid}}
 
== Post install ==
There are several considerations to take into account with a web server install, such as setting up an email server, setting up a firewall, firewalling web applications, and dynamically firewalling attackers.
 
=== Firewalls ===
* {{Package|net-firewall/nftables}}
* {{Package|net-firewall/iptables}} <-- suggested
* {{Package|net-firewall/firewalld}}
* {{Package|net-firewall/ufw}}
 
=== Dynamic Firewalling ===
* {{Package|app-admin/sshguard}} <-- suggested
* {{Package|net-analyzer/fail2ban}}
 
=== Webapp Firewalls ===
 
Apache has an option for webapplication firewalling.  as far as [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) can tell this passes login errors & excessive site fuzzing to logs for fail2ban/sshguard to deal with.
https://github.com/nbs-system/naxsi is a web app firewall for nginx.
 
=== Benchmarking ===
It's a good idea to benchmark your system, server, & websites.  There are several tools to assist you in doing this.
 
* http://toolbar.netcraft.com/site_report?url=undefined#last_reboot
* http://gtmetrix.com/
* http://www.showslow.com/
* http://yslow.org/
* http://getfirebug.com/
* {{Package|app-admin/apache-tools}}
* {{Package|app-benchmarks/sysbench}}
* {{Package|app-benchmarks/phoronix-test-suite}}
* {{Package|app-benchmarks/iozone}}
* {{Package|app-benchmarks/piozone}}
* {{Package|app-benchmarks/siege}}
* {{Package|app-benchmarks/ramspeed}}
* {{Package|app-benchmarks/jmeter}}

Revision as of 13:55, January 18, 2015

Pre-install considerations

ssl

Ssl wild card certificates can use the same certificate to cover several subdomain names. As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate. https://funtoo.org would not be covered under the wildcard, so Threesixes (talk) suggests using http://domain.tld as a http navigation splash page directory. All that is required to setup a ca signed ssl certificate is an email on the server. https://www.startssl.com offers free ssl ca certificates, though there are several other certificate providers. Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https://

sockets vs tcp stack

Sockets have less overhead but can not be shared across jails, or to other machines. Tcp stack has more overhead but is far more flexible.

Email Servers

FTP Servers

It is common practice to use FTP servers to host files for downloading.

Webserver

Web servers come in several varieties. The most common stack is known as LAMP which stands for linux apache mysql php. Threesixes (talk) suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.

Databases

mariadb is a drop in replacement for mysql

percona is a drop in replacement for mysql

  • No results

Languages

Web Servers


SSL Termination, Reverse Proxies, & load balancing

Reverse proxies are useful, some cache static data, and shuck out cached pages rather than hitting the web server. Some pass requests to backend nodes high availability clustering your website, some web servers have this functionality built in.

Post install

There are several considerations to take into account with a web server install, such as setting up an email server, setting up a firewall, firewalling web applications, and dynamically firewalling attackers.

Firewalls

Dynamic Firewalling

Webapp Firewalls

Apache has an option for webapplication firewalling. as far as Threesixes (talk) can tell this passes login errors & excessive site fuzzing to logs for fail2ban/sshguard to deal with. https://github.com/nbs-system/naxsi is a web app firewall for nginx.

Benchmarking

It's a good idea to benchmark your system, server, & websites. There are several tools to assist you in doing this.