forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitpod.yml
59 lines (56 loc) · 2.26 KB
/
.gitpod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
image:
file: .gitpod.Dockerfile
tasks:
- name: Development app
init: |
(
[ $(sudo pg_lsclusters -h | wc -l) -eq 0 ] && (
sudo mkdir -p /workspace/etc/postgresql /workspace/var/lib/postgresql &&
sudo chown -R postgres:postgres /workspace/etc/postgresql /workspace/var/lib/postgresql &&
sudo pg_createcluster $PGVERSION main
) || echo "Database exists"
) &&
sudo service postgresql start &&
(
[ $(sudo su postgres -c "psql -At -c \"SELECT COUNT(usename) FROM pg_user WHERE usename = '${DATABASE_USERNAME}'\"") -eq 0 ] && (
sudo su postgres -c "psql -c 'CREATE USER $DATABASE_USERNAME SUPERUSER'" &&
sudo su postgres -c "psql -c \"ALTER ROLE $DATABASE_USERNAME WITH PASSWORD '${DATABASE_PASSWORD}'\""
) || echo "Database user exists"
) &&
mkdir -p .vscode &&
echo '{"workbench.startupEditor": "none"}' > .vscode/settings.json &&
bundle install --jobs 4 &&
bundle exec rake development_app &&
echo 'Rails.application.config.hosts << ENV.fetch("RAILS_DEVELOPMENT_HOST", "")' > development_app/config/initializers/gitpod.rb &&
echo 'Rails.application.config.action_mailer.default_url_options = { protocol: "https" }' >> development_app/config/initializers/gitpod.rb &&
cd development_app &&
./bin/rails decidim:pwa:generate_vapid_keys | grep VAPID_ >> ../.rbenv-vars &&
echo "Compiling assets, please wait a moment..." &&
./bin/webpacker
command: |
sudo service postgresql start &&
{ [ $(basename $PWD) == "development_app" ] || cd development_app ; } &&
./bin/rails runner 'Decidim::Organization.first.update!(host: ENV.fetch("RAILS_DEVELOPMENT_HOST", "localhost"))' &&
./bin/rails s -b 0.0.0.0
ports:
- name: Web App
description: The main application web server
port: 3000
onOpen: open-preview
visibility: public
- name: Webpacker
description: The webpacker dev server for asset reloading
port: 3035
onOpen: ignore
visibility: public
- name: Database
description: PostgreSQL database server
port: 5432
onOpen: ignore
visibility: private
github:
prebuilds:
addCheck: true
master: false
pullRequests: true
pullRequestsFromForks: true