Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sleede/openlab-projects
Connect multiple Fab-managers to share projects documentation
https://github.com/sleede/openlab-projects
documentation fablab
Last synced: about 2 months ago
JSON representation
Connect multiple Fab-managers to share projects documentation
- Host: GitHub
- URL: https://github.com/sleede/openlab-projects
- Owner: sleede
- License: mit
- Created: 2016-05-02T09:59:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T23:55:09.000Z (almost 2 years ago)
- Last Synced: 2024-03-26T06:25:47.086Z (9 months ago)
- Topics: documentation, fablab
- Language: Ruby
- Homepage:
- Size: 187 KB
- Stars: 4
- Watchers: 7
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
## README
## Setup a development environment
1. Install RVM, with the ruby version specified in the [.ruby-version file](../.ruby-version).
For more details about the process, please read the [official RVM documentation](http://rvm.io/rvm/install)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](https://docs.docker.com/engine/install/) to set up a recent version of docker.3. Add your current user to the docker group, to allow using docker without `sudo`.
```bash
# 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
```4. Retrieve the project from Git
```bash
git clone https://github.com/sleede/openlab-projects.git
```5. 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.```bash
cd openlab-projects
cd .docker
cat hosts | sudo tee -a /etc/hosts
docker-compose up -d
cd -
```6. Init the RVM instance and check it's correctly configured
```bash
rvm current | grep -q `cat .ruby-version`@openlab && echo "ok"
# Must print ok, otherwise try "rvm use"
```7. Install bundler in the current RVM gemset
```bash
gem install bundler
```8. Install the required ruby gems
```bash
bundle install
```9. Create the default configuration file
```bash
cp config/database.yml.default config/database.yml
```10. 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](config/initializers/devise.rb)
```bash
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rails db:setup
```11. Create the pids folder used by Sidekiq. If you want to use a different location, you can configure it in [config/sidekiq.yml](config/sidekiq.yml)
```bash
mkdir -p tmp/pids
```12. Start the development web server
```bash
foreman s
```13. You should now be able to access your local development Fab-manager instance by accessing `http://localhost:3300` in your web browser.
14. You can log in as the default administrator using the credentials defined previously.
#### Emails
Access `http://localhost:3300/letter_opener` to see the emails received.
This interface is available only in development.### prod env
We use docker-compose to run the app in production.
See [docker/README.md](docker/README.md) for more details.
```bash
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.```bash
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
```bash
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
```bash
docker-compose down
docker-compose up -d
```### tests
to run the test suite:
```bash
bundle exec rails test
```### Migrate from elastic to pg
- go on old server with old app code (with elastic)
- open rails c
- run
```ruby
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