- Install RVM, with the ruby version specified in the .ruby-version file. For more details about the process, please read the official RVM documentation
2.Install docker and docker-compose. Your system may provide a pre-packaged version of docker in its repositories, but this version may be outdated. Please refer to the official docker documentation to set up a recent version of docker.
-
Add your current user to the docker group, to allow using docker without
sudo
.# add the docker group if it doesn't already exist sudo groupadd docker # add the current user to the docker group sudo usermod -aG docker $(whoami) # restart to validate changes sudo reboot
-
Retrieve the project from Git
git clone https://github.com/sleede/openlab-projects.git
-
Move into the project directory and install the docker-based dependencies.
⚠ If you are using Mac OS X, you must first edit the docker-compose.yml to use port binding instead of ip-based binding. This can be achieved by uncommenting the "port" directives and commenting the "networks" directives in the docker-compose.yml file. The hosts file must be modified too, accordingly.
⚠
ERROR: Pool overlaps with other one on this address space
In this case, you must modify the /etc/hosts and docker-compose.yml files to change the network from 172.19.y.z to 172.x.y.z, where x is a new unused network.cd openlab-projects cd .docker cat hosts | sudo tee -a /etc/hosts docker-compose up -d cd -
-
Init the RVM instance and check it's correctly configured
rvm current | grep -q `cat .ruby-version`@openlab && echo "ok" # Must print ok, otherwise try "rvm use"
-
Install bundler in the current RVM gemset
gem install bundler
-
Install the required ruby gems
bundle install
-
Create the default configuration file
cp config/database.yml.default config/database.yml
-
Build the databases.
🛈 Please note: Your password length must be between 8 and 72 characters, otherwise db:setup will be rejected. This is configured in config/initializers/devise.rb
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rails db:setup
- Create the pids folder used by Sidekiq. If you want to use a different location, you can configure it in config/sidekiq.yml
mkdir -p tmp/pids
- Start the development web server
foreman s
-
You should now be able to access your local development Fab-manager instance by accessing
http://localhost:3300
in your web browser. -
You can log in as the default administrator using the credentials defined previously.
Access http://localhost:3300/letter_opener
to see the emails received.
This interface is available only in development.
We use docker-compose to run the app in production. See docker/README.md for more details.
mkdir -p /apps/openlab-projects/config/nginx/ssl
cd /apps/openlab-projects
curl -sSL https://raw.githubusercontent.com/sleede/openlab-projects/dev/docker/docker-compose.yml > docker-compose.yml
curl -sSL https://raw.githubusercontent.com/sleede/openlab-projects/dev/docker/env.example > config/env
curl -sSL https://raw.githubusercontent.com/sleede/openlab-projects/dev/docker/nginx.conf > config/nginx/nginx.conf
docker-compose pull
- Build the certificate with let's encrypt or copy an existing one on the server folder.
- Change the docker-compose.yml file accordingly to bind the certificate directory to the nginx service.
- Change the nginx configuration to use the certificate.
curl -sSL https://raw.githubusercontent.com/sleede/openlab-projects/dev/docker/nginx.ssl.conf > config/nginx/nginx.conf
- Restart nginx
If any asset has changed, recompile them
rm -rf public/assets/
docker-compose run --rm openlab-projects bundle exec rake assets:precompile
If the database has changed (migration) or any other change occurred, run the specific commands like the "asset precompile" one (eg. bundle exec rake db:migrate).
Finally, restart the container
docker-compose down
docker-compose up -d
to run the test suite:
bundle exec rails test
- go on old server with old app code (with elastic)
- open rails c
- run
File.write("#{Rails.root}/_____CHEMIN____/projects.yml", YAML.dump(Project.find_each.map(&:attributes)))
- save the file in some place
- upgrades openlab app
- enter in the container
- create folder data
- move the projects.yml into /app/data
- run rails openlab:projects:import_from_yml_dump task
- open rails console and check that everything is OK
- remove file