Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ares committed Sep 26, 2014
1 parent a9f368f commit 97c7eb1
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 7 deletions.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,29 @@ Staypuft is the name of the OpenStack Foreman Installer plugin for The Foreman.

## Installation

See [How_to_Install_a_Plugin](http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Plugin)
for how to install Foreman plugins

Symlink `config/staypuft.local.rb` to yours Foreman `bundle.d`.
You can either use [staypuft-installer](https://github.com/theforeman/foreman-installer-staypuft) which is basically
foreman installer with staypuft specific wizards or you can install staypuft
plugin into existing foreman instance. The first options is preferred and you
can find more instructions in installer README.

ln -s ../../Staypuft/config/staypuft.local.rb staypuft.local.rb
See [How to Install a Plugin](http://theforeman.org/manuals/1.6/index.html#6.1InstallaPlugin)
for how to install Foreman plugins

## Development setup

See [this](doc/setup.md) document.
See howto for development setup
- [fedora 19](doc/setup_fedora.md)
- [centos 6.5](doc/setup_centos.md) - a bit easier way

## Contributing

Fork and send a Pull Request. Thanks!
If you found an issue, you can report it in [Bugzilla](https://bugzilla.redhat.com/buglist.cgi?component=rubygem-staypuft&product=Red%20Hat%20OpenStack).
If you want to chat about the issue or staypuft in general, we are on freenode
irc server on channel #staypuft. We also have mailing list to which you can
subscribe [here](https://www.redhat.com/mailman/listinfo/rdo-list). For staypuft
related questions please add [Installer] tag in subject.

If you want to send a patch, fork the projects and send a Pull Request. Thanks!

## Release a new version

Expand Down
139 changes: 139 additions & 0 deletions doc/setup_centos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Devel setup on CentOS 6.5

This howto describe how to install latest version from RPM using installer
and then migrate installed foreman and staypuft from git so you can easily
change source code and create pull requests.

We start by installing staypuft-installer from foreman nightly repositories

```sh
yum install -y http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm
yum install -y http://yum.theforeman.org/nightly/el6/x86_64/foreman-release.rpm
yum install -y foreman-installer-staypuft
```

Now we run the installer which and tell it to download latest discovery images
for us.

```
staypuft-installer --foreman-plugin-discovery-install-images=true
```

You will have to answer several questions. You should configure your NTP server,
users usually have issue if they are in VPN which restrict NTP to some internal
server. Also it's common to configure DHCP Gateway to be the same as Host Gateway
if you don't configure your staypuft machine to be the router.

Precise networking configuration depends on your setup so you should verify that
all networking options make sense for you layout. Also I recommend setting your
own password and/or ssh public key.

The above option makes staypuft-installer interactive; for non-interactive usage,
explore `staypuft-installer --help`. Note that you would need to set up quite
a lot of things manually if you want to run installer in non-interactive mode.

If you encounter issues during installation (failing DB migrations) and you rerun
the installer it won't remigrate your database. In such case there's a simple
workaround. Just run `echo >> ~foreman/config/database.yml` and the installer will
force migration and seed run.

One workaround is currently required for CentOS provisioning. After you login to
your foreman instnace you must update installation media path.
Go to Hosts -> Installation Media and update the path of the CentOS entry to:
"http://mirror.centos.org/centos/$major/os/$arch"
More information about the issue and it's status is [tracked here](http://projects.theforeman.org/issues/6884)

Now you should have foreman with staypuft running in production mode,
now we'll have to run foreman with all plugins from git in development mode. The
process consists of two steps, stage 1 running foreman from git and stage2
running plugins from git.

## STAGE 1, getting foreman from git (may not be needed if you want to work on staypuft only)

We suppose that git is already installed. We clone the repo to /usr/share/foreman_git.
You can change this directory, just make sure you also modify other commands below.

```sh
cd /usr/share
git clone https://github.com/theforeman/foreman.git foreman_git
cp -a foreman/config/database.yml foreman_git/config/
cp -a foreman/config/settings.yaml foreman_git/config/
cp foreman/bundler.d/* foreman_git/bundler.d
```

Now we need to install dependencies so gems with native extensions will install correctly.

```sh
yum install -y gcc ruby193-ruby-devel ruby-devel libxml2 libxml2-devel libxslt libxslt-devel postgresql-libs postgresql-devel gcc-c++
cd foreman_git
chown foreman config.ru
scl enable ruby193 'bundle install --without sqlite mysql mysql2 libvirt vmware gce'
# get a coffee, bundle install will take some time
```

Some users reported nokogiri errors, to workaround, run this command first and then rerun bundle install
```sh
scl enable ruby193 'gem install nokogiri --no-ri --no-rdoc -- --use-system-libraries'
```

After your bundle install finished successfully you can continue with configuration changes.
```sh
sed -i s/production/development/ config/database.yml
ln -s /var/run/foreman tmp
touch log/development.log
chmod 0666 log/development.log
cd /etc/httpd/conf.d
sed -i "s#share/foreman/#share/foreman_git/#g" ./05-foreman.conf
sed -i 's#share/foreman$#share/foreman_git#g' ./05-foreman.conf
sed -i "s#share/foreman/#share/foreman_git/#g" ./05-foreman-ssl.conf
sed -i 's#share/foreman$#share/foreman_git#g' ./05-foreman-ssl.conf
echo 'RailsEnv development' > 05-foreman.d/passenger_env.conf
echo 'RailsEnv development' > 05-foreman-ssl.d/passenger_env.conf
service httpd restart
```

To be able to run rails console under SCL edit /usr/share/foreman_git/config/database.yml, and specify the host for the development db connection, otherwise Ident authentication will fail. It should look similar to this:
```yaml
development:
adapter: postgresql
host: localhost
database: foreman
username: foreman
password: "foo"
```
## STAGE 2, getting staypuft from git
Now you're running foreman from git but all dependencies are installed as gems.
If you want to work on plugins you may want to install them from git as well,
this howto describes the process for staypuft plugin but could be easily
applied to other plugins as well.
```sh
cd /usr/share/
git clone https://github.com/theforeman/staypuft.git staypuft_git
echo "gem 'staypuft', :path => '/usr/share/staypuft_git'" > foreman_git/bundler.d/staypuft.rb
cd foreman_git
scl enable ruby193 'bundle install --without sqlite mysql mysql2 libvirt vmware gce'
service httpd restart
```

## DONE

Now you are running foreman and staypuft from git repositories. Foreman is
configured to run in development environment so you can see debug level logs
and the code is automatically reloaded.

you can edit foreman in `/usr/share/foreman_git`
you can edit staypuft in `/usr/share/staypuft_git`
after each update of either foreman or staypuft from git, don't forget to run:
```sh
bundle exec rake db:migrate
bundle exec rake db:seed
```

This will make sure that your database is up to date.
To restart the application (it's running in development env) just `touch tmp/restart.txt`

Make sure you run all of these commands in you foreman_git repo.

File renamed without changes.

0 comments on commit 97c7eb1

Please sign in to comment.