The purpose of the Shift/Pedalpalooza Calendar is to empower citizens to create and view bike events and to spread bike fun.
You can see the production site here: https://www.shift2bikes.org
The calendar is split into two main parts: a frontend, and a backend. The frontend is what most people think of the as the Shift website: it includes all of the webpages and static content. The backend holds all of the user submitted rides, and sends emails to users when they create new rides.
The frontend uses:
The backend uses:
While creating a pull request does automatically deploy a preview of the frontend to Netlify, you can also create previews manually: this could help you do things like theme development in your own repository before submitting your pr.
[context.production]
section and make changes if needed.netlify.toml
should mean 0 additional configuration required to get the site running. If you get a build failure around access denied for ssh, you probably need the advice in step 2 just above this!If you have trouble with it please file an issue to let us know what you tried and what happened when you did.
The production backend is run in several docker containers; including nginx, mysql, and the node server.
The docker configuration also supports running your own frontend and backend server locally. The following steps assume a Linux, or MacOs development environment. On Windows, you'll need something like the Windows Subsystem for Linux.
git clone https://github.com/shift-org/shift-docs.git
cd shift-docs ; ./shift up
./shift mysql-pipe < services/db/seed/setup.sql
.https://localhost:4443/
. If this leads to an SSL error in chrome, you may try flipping this flag: chrome://flags/#allow-insecure-localhostNote that no changes to the filesystems inside the container should ever be needed; they read from your local filesystem so updating the local FS will show up in the container (perhaps after a restart). Updating, changing branches, etc can be done with git commands outside of the container (git checkout otherbranch
or git pull
).
So - now you can hopefully access the site. But a real end-toend test of yoursetup, would be creating an event:
services/node/shift-mail.log
. For local development, we don't actually send the email, so get the confirmation link from that mail log, visit it, and hit publish eventdocker-compose.yml
shift
docker-compose.yml
). Run env
inside an attached docker container to see the variables that made it into the running container.secrets
and secrets.override
shift.overrides
and shift.overrides.production
./shift attach node
node
is a reference to the named docker container. Note that you want just nginx
, db
or node
not the full image name (shift_nginx_1
)./shift up
./shift logs nginx
./shift down
docker ps
docker volume ls
shift_
export COMPOSE_PROJECT_NAME="shift"
You can also do local development with node. These steps will setup a local node server which, by default, acts as both frontend and backend.
After cloning the repo, install node (currently Node.js v20.11.1). Then, open a command prompt or terminal window, change to some useful directory for development, and do the following:
cd shift-docs
npm install
npm run -w tools make-fake-events
npm run dev
When you new create events, the link for activating those events will be written to the terminal. ( In this mode, Sqlite is used instead of MySQL. )
If you are writing javascript code in the node backend, you can test everything is working as expected using npm test
.
As an alternative to npm run dev
, you can preview a local frontend with the actual production backend by using: npm run -w tools preview
.
NOTE: any events you create while previewing this way will be seen by the world!
Before executing npm run dev
, you can configure email debugging using npm run -w tools new-ethereal-cfg
. It will generate a shift-email.cfg
file in your bin
directory which will be used when adding new events. Use the username and password listed in that file to check for emails here: https://ethereal.email/login.
No actual emails are sent when running this way.