Skip to content

Commit

Permalink
Merge 2748292 into 72ce8e4
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkperkins committed Apr 5, 2017
2 parents 72ce8e4 + 2748292 commit 356a7b5
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 91 deletions.
49 changes: 14 additions & 35 deletions docs/installation/centos-prep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ iptables
Let's just turn it off for now.
Please note, if you're using EC2 or some other cloud provider that has firewall rules enabled by default,
you will need to configure the particular firewall rules to gain access to the web server we'll start in the guide.
The default port for the webserver is 8000, so open this port up at a minimum.
(Port 22 for SSH will obviously be needed as well.)

.. code:: bash
sudo service iptables stop
If you'd like to lock down security more, here are the ports that need to be opened up:

22 - SSH
80 - HTTP
443 - HTTPS (optional)
4505 - salt
4506 - salt

SELinux
-------

Expand Down Expand Up @@ -57,13 +63,6 @@ For our purposes, it's completely out of scope, so we're going to disable it.
# If the output is 1 you're good to go.
EPEL
----

.. code:: bash
sudo rpm -Uvh http://mirror.steadfast.net/epel/6/i386/epel-release-6-8.noarch.rpm
Postgres
--------

Expand Down Expand Up @@ -102,41 +101,21 @@ Below we'll create a ``stackdio`` database and grant permissions to the
ALTER DATABASE stackdio OWNER to stackdio;
EOF
virtualenvwrapper
-----------------
.. code:: bash
# install the package
sudo yum install python-virtualenvwrapper
# Update the user's ~/.bash_profile to enable virtualenvwrapper
# You're using the stackdio user, right? :)
echo "source /usr/bin/virtualenvwrapper.sh" >> ~/.bash_profile
# re-source the .bash_profile
. ~/.bash_profile
Core requirements
-----------------
- gcc and other development tools
- git
- libpq-devel (the c header files for compiling the python postgres client)
- python-devel
- redis-server
- nginx
- libpq-devel (the c header files for compiling the python postgres client)
- python-devel (for compiling native python libraries)
- redis-server (for our cache / message queue)
- nginx (for serving static files)
To quickly get up and running, you can run the following to install the
required packages.
.. code:: bash
# Install the development tools group
sudo yum groupinstall "Development Tools"
# Install the other requirements needed to install stackd.io
sudo yum install git libpq-devel python-devel redis-server nginx nodejs npm
# Install requirements needed to install stackd.io
sudo yum install libpq-devel python-devel redis-server nginx
Next Steps
----------
Expand Down
59 changes: 28 additions & 31 deletions docs/installation/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ we may make some assumptions you don't agree with, and there may be things we mi
If you feel anything is out of the ordinary, a bit confusing,
or just plain missing, please :doc:`contact us<../contact>`.


1. A database
-------------

Expand All @@ -20,6 +21,7 @@ https://docs.djangoproject.com/en/1.9/ref/databases/

The OS-specific prep of your choice (below) will walk you through installing postgres.


2. OS-specific preparation
--------------------------

Expand All @@ -41,8 +43,13 @@ Once you finish, come back here and continue on.

.. _installation:

3. Create a virtualenv
----------------------

3. Create a virtualenv (Optional)
---------------------------------

We recommend that you create a virtualenv to separate your stackd.io dependencies out into a separate environment,
but it is completely optional. The following commands utilize virtualenvwrapper.
If you'd like to use it, it's documentation is found here: https://virtualenvwrapper.readthedocs.io/en/latest/

Let's create a virtualenv to install stackd.io into:

Expand All @@ -59,39 +66,25 @@ To do this, virtualenvwrapper gives you the ``workon`` command:
workon stackdio
4. Install bower
----------------

In your terminal, run the following command to install bower:

.. note::

You must have previously installed npm/node from the OS specific preparation

.. code:: bash
sudo npm install -g bower
5. Install stackd.io
4. Install stackd.io
--------------------

.. note::

Double-check that your virtualenv is activated or else this
If you created a virtualenv, double-check that it is activated or else this
will probably complain that you don't have permissions to install
(because it's trying to install into the global python site-packages
directory which we don't want!)
(because it's trying to install into the global python site-packages directory).

There's two options for installing here.
We recommend pulling the latest version from `pypi <https://pypi.python.org/pypi/stackdio-server>`__ with pip, like this:

.. code:: bash
workon stackdio # Activate the virtualenv
workon stackdio # Activate the virtualenv if you created one (optional)
pip install stackdio-server[production,postgres]
6. Configuration
5. Configuration
----------------

After the install, you'll have a ``stackdio`` command available to interact with much of the platform.
Expand All @@ -112,14 +105,14 @@ but if you deviated from the path you will need to provide the following informa
stackdio init
Now, let's populate are database with a schema:
Now, let's populate the database with a schema:

.. code:: bash
stackdio manage.py migrate
7. stackd.io users
6. stackd.io users
------------------

LDAP
Expand Down Expand Up @@ -153,7 +146,8 @@ Non-LDAP regular users
When not using LDAP, the easiest way to create new non-admin users is to use the built-in Django admin interface.
First we need the server to be up and running so keep following the steps below and we'll come back to adding users later.

8. Web server configuration

7. Web server configuration
---------------------------

For this guide, we'll use the ``stackdio`` command to generate the necessary configuration for Nginx to serve our static content as well as proxying the Python app through gunicorn.
Expand All @@ -162,14 +156,14 @@ To configure Nginx for CentOS:

.. code:: bash
# CENTOS
# CENTOS ONLY
# add execute permissions to the user's home directory for static content to serve correctly
chmod +x ~/
stackdio config nginx | sudo tee /etc/nginx/conf.d/stackdio.conf > /dev/null
# rename the default server configuration
# rename the default server configuration (only files matching *.conf get picked up)
sudo mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
To configure Nginx for Ubuntu:
Expand All @@ -195,7 +189,8 @@ and finally, start Nginx:
sudo service nginx restart
9. Redis, celery, and salt
8. Redis, celery, and salt
--------------------------

Start the redis server:
Expand All @@ -217,15 +212,17 @@ so we'll just need to configure supervisor and start the services.
supervisord -c ~/.stackdio/supervisord.conf
supervisorctl -c ~/.stackdio/supervisord.conf start all
10. Try it out!
---------------
9. Try it out!
--------------

At this point, you should have everything configured and running,
so fire up a web browser and point it to your hostname and you should see the stackd.io login page.
If you're using LDAP, try logging in with a user that is a member of the ``stackdio-admin`` and ``stackdio-user`` groups,
or login with the admin user you created earlier.

11. Creating additional users

10. Creating additional users
-----------------------------

.. note::
Expand All @@ -234,7 +231,7 @@ or login with the admin user you created earlier.

The superuser we created earlier will give us admin access to stackd.io,
however, you probably want at least one non-superuser.
Point your browser to http://hostname:8000/__private/admin and use the username and password for the superuser you created earlier.
Point your browser to http://<hostname>/__private/admin and use the username and password for the superuser you created earlier.
You should be presented with the Django admin interface.
To create additional users, follow the steps below.

Expand Down
31 changes: 7 additions & 24 deletions docs/installation/ubuntu-prep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Below we'll create a ``stackdio`` database and grant permissions to the ``stackd

**WARNING**: we're not focusing on security here, so the default
Postgres setup definitely needs to be tweaked, passwords changed, etc.,
but for a quick-start guide this is out of scope. Please, don't run
this as-is in production :)
but for a quick-start guide this is out of scope.
Please, don't run this as-is in production.

.. code:: bash
Expand All @@ -41,38 +41,21 @@ Below we'll create a ``stackdio`` database and grant permissions to the ``stackd
ALTER DATABASE stackdio OWNER to stackdio;
EOF
virtualenvwrapper
-----------------
.. code:: bash
# install the package
sudo apt-get install virtualenvwrapper
# post-install step for virtualenvwrapper shortcuts
source /etc/bash_completion.d/virtualenvwrapper
Core requirements
-----------------
- gcc and other development tools
- git
- libpq-dev (the c header files for compiling the python postgres client)
- python-dev
- redis-server
- libpq-dev (the c header files for compiling the python postgres client)
- python-dev (for compiling native python libraries)
- redis-server (for our cache / message queue)
- nginx (for serving static files)
To quickly get up and running, you can run the following to install the
required packages.
.. code:: bash
# Install requirements needed to install stackd.io
sudo apt-get install python-dev libpq-dev nodejs npm redis-server git nginx gcc
.. code:: bash
# Link nodejs over to node - bower will complain otherwise
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install libpq-dev python-dev redis-server nginx
Next Steps
----------
Expand Down
2 changes: 1 addition & 1 deletion docs/webserver-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Common Steps
------------

To do some of the steps below you will need to have already installed stackdio and be in the virtual environment.
To make sure you're in the virtualenv:
To make sure you're in the virtualenv if you created on when installing (optional):

.. code:: bash
Expand Down
42 changes: 42 additions & 0 deletions stackdio/api/cloud/fixtures/cloud_objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,48 @@
"description": "Storage Optimized I2 Eight Extra Large Instance",
"provider_id": 1
},
{
"instance_id": "i3.large",
"slug": "i3.large",
"title": "i3.large",
"description": "Storage Optimized I3 Large Instance",
"provider_id": 1
},
{
"instance_id": "i3.xlarge",
"slug": "i3.xlarge",
"title": "i3.xlarge",
"description": "Storage Optimized I3 Extra Large Instance",
"provider_id": 1
},
{
"instance_id": "i3.2xlarge",
"slug": "i3.2xlarge",
"title": "i3.2xlarge",
"description": "Storage Optimized I3 Double Extra Large Instance",
"provider_id": 1
},
{
"instance_id": "i3.4xlarge",
"slug": "i3.4xlarge",
"title": "i3.4xlarge",
"description": "Storage Optimized I3 Quadruple Extra Large Instance",
"provider_id": 1
},
{
"instance_id": "i3.8xlarge",
"slug": "i3.8xlarge",
"title": "i3.8xlarge",
"description": "Storage Optimized I3 Eight Extra Large Instance",
"provider_id": 1
},
{
"instance_id": "i3.16xlarge",
"slug": "i3.16xlarge",
"title": "i3.16xlarge",
"description": "Storage Optimized I3 Sixteen Extra Large Instance",
"provider_id": 1
},
{
"instance_id": "d2.xlarge",
"slug": "d2.xlarge",
Expand Down
15 changes: 15 additions & 0 deletions systemd/celery-beat.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=stackdio celery beat scheduler
After=network.target

[Service]
LimitNOFILE=16384
Type=simple
User=stackdio
Group=stackdio
Restart=always
PIDFile=/var/run/stackdio/celery-beat.pid
ExecStart=/usr/local/bin/stackdio celery beat -s /var/lib/stackdio/supervisor-celery-schedule.db --logfile=/var/log/stackdio/celery-beat.log --pidfile=/var/run/stackdio/celery-beat.pid

[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions systemd/celery-main.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=stackdio celery worker
After=network.target

[Service]
LimitNOFILE=16384
Type=single
User=stackdio
Group=stackdio
Restart=always
PIDFile=/var/run/stackdio/celery-main.pid
ExecStart=/usr/local/bin/stackdio celery worker --pidfile=/var/run/stackdio/celery-main.pid --logfile=/var/log/stackdio/celery-main.log -Ofair -Q default,stacks -n main.%%h
Environment=PYTHONOPTIMIZE=1

[Install]
WantedBy=multi-user.target

0 comments on commit 356a7b5

Please sign in to comment.