Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ddev config file #111

Merged
merged 27 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
91bf715
Prototype v1 based on laravel template.
bmartinez287 Oct 9, 2023
e328df9
Clean up extra settings.
bmartinez287 Oct 9, 2023
89fa044
Update config based on feedback.
bmartinez287 Oct 9, 2023
e3221f6
Added astro dev deamon.
bmartinez287 Oct 10, 2023
6b5050e
Fixed typo.
bmartinez287 Oct 10, 2023
131d888
Testing new settings to make Hot module reloading avaliable with vite…
bmartinez287 Oct 11, 2023
0c64d74
Got it working, I will add instructions to the docs next. kuddos to c…
bmartinez287 Oct 13, 2023
3a35d19
test 2.
bmartinez287 Oct 13, 2023
f56b088
Added README instructions, plus cleanup config and added comments.
bmartinez287 Oct 13, 2023
8537080
Fix README.md
bmartinez287 Oct 13, 2023
136c247
Fix README.md v2
bmartinez287 Oct 13, 2023
8abc405
Fix README.md v3
bmartinez287 Oct 13, 2023
5c8754f
Added changes as requested on PR review v1.
bmartinez287 Oct 15, 2023
28f4f86
Added changes as requested on PR review v2.
bmartinez287 Oct 15, 2023
45a4816
Updated config based on feedback v2
bmartinez287 Oct 16, 2023
3993f7e
Updated config based on feedback ve
bmartinez287 Oct 16, 2023
4669b0b
Testing new settings to avoid EPERM error.
bmartinez287 Oct 16, 2023
115c1a2
Updated working version of the PR.
bmartinez287 Oct 16, 2023
60faaec
Updated working version of the PR v2.
bmartinez287 Oct 16, 2023
fa88a8c
updated the docs with troubleshooting steps.
bmartinez287 Oct 16, 2023
b272eab
Added README suggestions.
bmartinez287 Oct 19, 2023
6de4fbe
Fix package-lock.json conflict.
bmartinez287 Oct 19, 2023
c849d47
Updated README info.
bmartinez287 Oct 19, 2023
a002105
Updated README info v2.
bmartinez287 Oct 19, 2023
4b8e5df
use node v20 as in config.yaml
rfay Nov 8, 2023
29ac25b
update package-lock.json
rfay Nov 8, 2023
f9d2691
Update README.md
bmartinez287 Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
type: php
docroot: dist
webserver_type: nginx-fpm
additional_hostnames: []
additional_fqdns: []
performance_mode: mutagen # Important to avoid EPERM errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to know what mode you were using and what docker provider you were using that gave you trouble.

use_dns_when_possible: true
web_environment: []
nodejs_version: "20"
disable_upload_dirs_warning: true

# 4321 is Astro Vite default
web_extra_exposed_ports:
- name: astro-dev
container_port: 4321
http_port: 4322
https_port: 4321

# The extra -- in `npm run dev -- --host` is a Vite requirement
# https://github.com/vitejs/vite/discussions/3396
web_extra_daemons:
- name: astro-dev-daemon
command: "sleep 3 && npm run dev -- --host" # sleep avoids race conditions
directory: /var/www/html
hooks:
post-start:
- exec-host: echo -e " NOTICE \n
=================================================================================\n
=================================================================================\n
The Astro dev container is ready \n
By default it will be available at ${DDEV_PRIMARY_URL}:4321 \n
Use ddev describe to confirm if this doesn't work. \n
Check the startup status by running ddev logs --follow --time \n"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: Install dependencies
run: npm ci
- name: Lint
Expand Down
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,39 @@ All commands are run from the root of the project, from a terminal:
| `npm run textlint` | Run textlint on content collections |
| `npm run textlint:fix` | Apply fixable updates to resolve texlint errors |



### Local Development Setup

1. Run `cp .env.example .env` to create a `.env` file for environment variables. (Don’t check this in!)
2. Create a [classic GitHub access token](https://github.com/settings/tokens) with these scopes: `repo`, `read:org`, `read:user`, and `read:project`.
3. Paste the GitHub token after `.env`’s `GITHUB_TOKEN=`.

#### DDEV setup

DDEV already has all the dependencies included.

1. Run `ddev start && ddev npm install` to set up the project’s dependencies. Then `ddev npm run build`. If anything fails then run `ddev npm cache clean --force && ddev npm install && ddev restart`. This should be a one time setup.
3. `ddev npm run build` can be found at https://<projectname>.ddev.site and `ddev npm run dev` is found at https://<projectname>.ddev.site:4321.The dev server has Vite HMR (hot module reloading) among other features. The site will automatically refresh as you work on it, displaying errors in the relevant terminal or browser console.

To generate a static copy of the site, run `ddev npm run build`. The contents of the `dist/` folder are exactly what get [deployed to Cloudflare Pages](#build--deployment). You can preview locally by running `ddev npm run preview` or using a tool like [`serve`](https://www.npmjs.com/package/serve).

#### Setup without DDEV

Check out the project in your favorite Node.js environment, ideally running [`nvm`](https://github.com/nvm-sh/nvm). We’ll install dependencies, add a GitHub API key, and run a local dev server with a hot-reloading browser URL.

1. Run `nvm use` to make sure you’re running an appropriate Node.js version.
2. Run `npm install` to set up the project’s dependencies.
3. Run `cp .env.example .env` to create a `.env` file for environment variables. (Don’t check this in!)
4. Create a [classic GitHub access token](https://github.com/settings/tokens) with these scopes: `repo`, `read:org`, `read:user`, and `read:project`.
bmartinez287 marked this conversation as resolved.
Show resolved Hide resolved
5. Paste the GitHub token after `.env`’s `GITHUB_TOKEN=`.
6. Run `npm run dev` to start Astro’s dev server.
7. Visit the URL displayed in your terminal. (Probably `http://127.0.0.1:3000/`.) The site will automatically refresh as you work on it, displaying errors in the relevant console (terminal or browser).
3. Run `npm run dev` to start Astro’s dev server. If it fails then run `npm cache clean --force && npm install && npm run dev`.
4. Visit the URL displayed in your terminal. (Probably `http://localhost:4321/`.) The site will automatically refresh as you work on it, displaying errors in the relevant terminal or browser console.

To generate a static copy of the site, run `npm run build`. The contents of the `dist/` folder are exactly what get [deployed to Cloudflare Pages](#build--deployment). You can preview locally by running `npm run preview` or using a tool like [`serve`](https://www.npmjs.com/package/serve).


#### Switching from Without DDEV to with DDEV

Make sure to delete your `node_modules/` directory and run `npm install`. The change in architecture can create odd issues otherwise.
bmartinez287 marked this conversation as resolved.
Show resolved Hide resolved

## Managing Content

The site’s content lives in either `.astro` components that resemble souped-up HTML, or Markdown files organized into schema-validated [content collections](https://docs.astro.build/en/guides/content-collections/).
Expand Down
6 changes: 5 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import widont from "rehype-widont"

// https://astro.build/config
export default defineConfig({
site: "https://ddev.com/",
site: "https://ddev.com",
vite: {
server: {
host: true, // leave this unchanged for DDEV!
}},
integrations: [
tailwind(),
react(),
Expand Down
Loading