-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add hybrid setup config * Various fixes * Improve startup * Don't try to bring app up in start * Add mockdata config * Improve startup * More QoL improvements * Improve startup * Add ruby lsp ext after start * Create log dir on start * Improvements * Change setup to facilitate ruby lsp extension installation * Remove manual extension installation * Fix startup script * More work on deps * Set user id when starting deps * More adjustments to startup scripts * simplify docker deps setup * Wait for the api to be ready before exiting the startup script * More QoL improvements * Change setup order * Add output for permissions set * Adjust permissions approach * One more adjustment * Belt & suspenders * More perms adjustment * Simplify startup * Add native setup * Change ruby setup to enable * Add hardware requirements * Add test DB config * Add docs * Update postgres version * Update redis version * Fix foreman output * Use different redis package * Minor debug output * Don't bother with starting the app * Improve test database config * Update doc * Remove host requirements * Only notify for port forwarding on 3000 * Allow access from localhost and shared github URLs. * Change ownership * Remove host header check This was obviated by the addition of the HostAuthorization middleware in Rails 6 * Add test DB setup to main local settings file * Update tests
- Loading branch information
Showing
12 changed files
with
171 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "vets-api native setup", | ||
"image": "mcr.microsoft.com/devcontainers/base:bullseye", | ||
|
||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/ruby-asdf:0": { | ||
"version": "3.2.3" | ||
}, | ||
"ghcr.io/robbert229/devcontainer-features/postgresql-client:1": { | ||
"version": "15" | ||
}, | ||
"ghcr.io/devcontainers-contrib/features/redis-homebrew:1": { | ||
"version": "6.2" | ||
} | ||
}, | ||
|
||
"forwardPorts": [ | ||
3000, | ||
9293, | ||
5432, | ||
6379 | ||
], | ||
"portsAttributes": { | ||
"3000": { | ||
"label": "vets-api", | ||
"onAutoForward": "notify", | ||
"requireLocalPort": true | ||
}, | ||
"9293": { | ||
"label": "vets-api-healthcheck", | ||
"onAutoForward": "silent", | ||
"requireLocalPort": true | ||
}, | ||
"5432": { | ||
"label": "postgis", | ||
"onAutoForward": "silent", | ||
"requireLocalPort": true | ||
}, | ||
"6379": { | ||
"label": "redis", | ||
"onAutoForward": "silent", | ||
"requireLocalPort": true | ||
} | ||
}, | ||
|
||
"postCreateCommand": "sh .devcontainer/post-create.sh", | ||
"postStartCommand": "sh .devcontainer/post-start.sh", | ||
|
||
"customizations": { | ||
"codespaces": { | ||
"repositories": { | ||
"department-of-veterans-affairs/vets-api-mockdata": { | ||
"permissions": { | ||
"contents": "read", | ||
"pull_requests": "write" | ||
} | ||
} | ||
} | ||
}, | ||
"vscode": { | ||
"extensions": ["ms-azuretools.vscode-docker", "Shopify.ruby-lsp"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
|
||
# Add welcome message | ||
sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt | ||
|
||
# Switch to vets-api ruby version | ||
export PATH="${HOME}/.asdf/shims:${HOME}/.asdf/bin:${PATH}" | ||
asdf install ruby $( cat .ruby-version ) | ||
asdf global ruby $( cat .ruby-version ) | ||
|
||
git clone https://github.com/department-of-veterans-affairs/vets-api-mockdata.git ../vets-api-mockdata | ||
|
||
sudo apt update | ||
sudo apt install -y libpq-dev pdftk shared-mime-info postgresql-15-postgis-3 | ||
|
||
gem install bundler | ||
NUM_CORES=$( cat /proc/cpuinfo | grep '^processor'|wc -l ) | ||
bundle config --global jobs `expr $NUM_CORES - 1` | ||
|
||
# Update test DB config | ||
echo 'test_database_url: postgis://postgres:password@localhost:5432/vets_api_test?pool=4' > config/settings/test.local.yml | ||
|
||
# Add service config | ||
if [ ! -f config/settings.local.yml ]; then | ||
cp config/settings.local.yml.example config/settings.local.yml | ||
cat <<EOT >> config/settings.local.yml | ||
database_url: postgis://postgres:password@localhost:5432/vets_api_development?pool=4 | ||
test_database_url: postgis://postgres:password@localhost:5432/vets_api_test?pool=4 | ||
redis: | ||
host: localhost | ||
port: 6379 | ||
app_data: | ||
url: redis://localhost:6379 | ||
sidekiq: | ||
url: redis://localhost:6379 | ||
betamocks: | ||
cache_dir: ../vets-api-mockdata | ||
# Allow access from localhost and shared github URLs. | ||
virtual_hosts: ["127.0.0.1", "localhost", !ruby/regexp /.*\.app\.github\.dev/] | ||
EOT | ||
fi | ||
|
||
mkdir -p log | ||
nohup bash -c '/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/redis-server /home/linuxbrew/.linuxbrew/etc/redis.conf' >> log/redis.log 2>&1 & | ||
sudo /etc/init.d/postgresql restart | ||
pg_isready -t 60 | ||
sudo -u root sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'password';" | ||
./bin/setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
echo "Starting redis..." | ||
nohup /home/linuxbrew/.linuxbrew/opt/[email protected]/bin/redis-server /home/linuxbrew/.linuxbrew/etc/redis.conf >> log/redis.log 2>&1 & | ||
|
||
echo "Starting postgres..." | ||
sudo /etc/init.d/postgresql restart | ||
echo "Waiting for postgres to be ready..." | ||
pg_isready -t 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
~~~~~~ Welcome to vets-api on codespaces! ~~~~~~ | ||
|
||
For more information, see the codespaces README in docs/setup. | ||
|
||
~~~~~~ Quickstart ~~~~~ | ||
|
||
To start vets-api, run this command: | ||
|
||
foreman start -m all=1,clamd=0,freshclam=0 |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Codespaces setup | ||
|
||
## About codespaces | ||
|
||
Github Codespaces provide an Integrated Development Environment (IDE) that is accessible entirely in a web browser. It is essentially a web based version of VS Code running on a cloud based virtual machine. | ||
|
||
Codespaces is available for all members of the Department of Veterans Affairs organization on Github. | ||
|
||
### More information | ||
|
||
- [Platform documentation for codespaces](https://depo-platform-documentation.scrollhelp.site/developer-docs/using-github-codespaces) | ||
- See the #codespaces channel in Slack for additional questions about using Codespaces. | ||
|
||
## Creating a codespace | ||
|
||
1. Go to [your Codespaces page](https://github.com/codespaces) on Github. | ||
2. Click the [new Codespace](https://github.com/codespaces/new) button at the top right. | ||
3. Select the vets-api repository and adjust other settings as desired, the defaults should work well. | ||
4. Click the 'Create codespace' button | ||
|
||
Your new codespace will open in Visual Studio Code if you have it installed locally, or otherwise in the browser. The vets-api repo and all dependencies will be installed, and it will be ready for use in about 5 minutes. | ||
|
||
## Using your codespace | ||
|
||
Your codespace will automatically start vets-api and forward port 3000 to your local machine if you have Visual Studio Code installed. The API can be accessed at http://localhost:3000/ | ||
|
||
For more information on running vets-api and specs, see the [native running instructions](running_natively.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.