diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..9e2544ea --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,32 @@ +# This configuration file was mainly inspired by ./doc/SETUP_DEVELOPMENT_DOCKER.md +tasks: + - name: Docker + init: | + # init docker containers + docker-compose -f docker-compose-dev.yml pull + docker-compose -f docker-compose-dev.yml up -d mariadb + docker-compose -f docker-compose-dev.yml run --rm foodsoft bundle install + docker-compose -f docker-compose-dev.yml run --rm foodsoft bundle exec rake foodsoft:setup_development_docker + # setup test database + docker-compose -f docker-compose-dev.yml run --rm mariadb mariadb --host=mariadb --password=secret --execute="CREATE DATABASE test" + docker-compose -f docker-compose-dev.yml run --rm foodsoft bundle exec rake db:schema:load RAILS_ENV=test DATABASE_URL=mysql2://root:secret@mariadb/test?encoding=utf8mb4 + command: | + # start docker containers + docker-compose -f docker-compose-dev.yml up + + - name: Rails + command: | + echo "The rails application is started in docker containers (see docker-compose-dev.yml)." + echo "For executing rails commands, open up a bash terminal inside the foodsoft container via 'docker-compose -f docker-compose-dev.yml exec foodsoft bash'" + +ports: + - port: 3000 + onOpen: open-preview + - port: 2080 + onOpen: notify + - port: 1080 + onOpen: notify + +vscode: + extensions: + - ms-azuretools.vscode-docker diff --git a/README.md b/README.md index 9facbdac..e9f89f42 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,11 @@ Get foodsoft [running locally](doc/SETUP_DEVELOPMENT.md), then visit our [Developing Guidelines](https://github.com/foodcoops/foodsoft/wiki/Developing-Guidelines) page on the wiki. +Get a foodsoft dev-environment running in the browser with Gitpod + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/mob-programming-meetup/foodsoft) + +Follow these [instructions](doc/SETUP_DEVELOPMENT_GITPOD.md) to complete setup from within the Gitpod workspace. Deploying --------- diff --git a/doc/SETUP_DEVELOPMENT_GITPOD.md b/doc/SETUP_DEVELOPMENT_GITPOD.md new file mode 100644 index 00000000..9807be7a --- /dev/null +++ b/doc/SETUP_DEVELOPMENT_GITPOD.md @@ -0,0 +1,17 @@ + +After opening the workspace, follow these steps to complete the setup: + +1. Login using the default credentials: `admin/secret` + +1. Change the admin password, just in case. + +1. Optionally, load an initial database (here seeded with `small.en`) by running + +``` + docker-compose -f docker-compose-dev.yml run --rm foodsoft \ + bundle exec rake db:schema:load db:seed:small.en +``` + +> Note: The gitpod env is setup to open the front-ends using a preview browser built into the workspace. You can also open these in browser tabs by clicking the icon next to address bar. Refer gitpod.io docs about [whitelisting workspaces](https://www.gitpod.io/docs/configure/browser-settings#browser-settings) to prevent pop-up blockers from blocking these tabs. + +The main configuration of the Gitpod workspace is in [/.gippod.yml](/.gitpod.yml). Check out https://www.gitpod.io/docs/config-gitpod-file for more information.