Configure root as the database user
First of all, make sure you have a copy of
<noosfero-root/config/database.yml.pgsql> on your
Since the container database comes already configured to the root user, you must change the user 'noosfero' on your yaml
<noosfero-root>/config/database.yml to 'root', e.g.:
development: adapter: postgresql encoding: unicode database: noosfero_development template: template0 - username: noosfero password: development: adapter: postgresql encoding: unicode database: noosfero_development template: template0 + username: root password:
Create tmp/pids folder
In case you just cloned your brand new noosfero respository, you may need to create the folder
tmp/pids on your repository so that the docker process may register their pids.
Start Noosfero in Development mode
sudo docker run -i -t -p 3000:3000 -v <noosfero-root>:/src/noosfero <docker-image> run-noosfero
To enter in interactive mode through bash:
sudo docker run -i -t -p 3000:3000 -v <noosfero-root>:/src/noosfero <docker-image> bash
If you ran the interactive mode, you should start PostgreSQL manually.
service postgresql start
IMPORTANT! Remember that after all changes the data are not persisted. To persist them you must use:
sudo docker commit <container-id> <tag/name> i.e.: sudo docker commit 0d8943818ecd noosfero-with-unicorn
The next time you decide to run this specific state you should use the tag you defined.
P.S.: We're still developing a automatic way to start postgresql. ;)
DO NOT run git commands inside the docker
Running git commands inside the docker may change the .git folder of your noosfero source permissions. In case you already did this before reading this documentation, you can fix your .git with:
$ sudo chown -R <USER>:<USER> <noosfero-root>/.git
Docker params used
- -p: to map the container port 3000 to the host port 3000 (this allows you to access the rails server through your host browser: localhost:3000.)
- -v: to mount docker volume data. This mounts your noosfero source located on the host machine, inside the container on the /src/noosfero directory.
- -i: to enter in interactive mode.
- -t: to enable tty.
- Improve run-noosfero script to receive environment argument (development, production, etc.)
- Include a script to open a rails console.
- Start postgresql automatically when the container is loaded.