git clone https://github.com/Tropicode-Guam/gymjim
.env
file
.env
frontend/settings
folder, create general.json
and insurances.json
files matching their example formats: general.sample.json
and insurances.sample.json
(read more about settings below)docker compose up -d --build
* note: this docker-compose.yml was made with docker rootless mode in mind. If you are running this in root mode (the default), you might need to start it by first unsetting the XDG_RUNTIME_DIR
environment variable like so: unset XDG_RUNTIME_DIR && docker-compose up -d --build
docker compose -f docker-compose.dev.yml up --build
graph TD
linkStyle default interpolate basis
user((user))---|internet:443|nginx
letsencrypt---|internet:80|nginx
subgraph server [your server: www.example.com]
subgraph docker [docker containers]
subgraph network [nginx: proxy-network]
nginx---frontend
nginx---api
nginx---certbot
frontend[Frontend]
certbot[[Certbot]]
api[Backend API]
end
subgraph db [db network: db]
mongo[(mongodb<br>gym_classes_db)]
api[Backend API]---|shared db network|mongo
end
certbot---certs([gymjim_certs])
nginx---certs
end
frontend---settings{{frontend/settings}}
mongo---data{{db/data}}
end
.env
file and be careful with commas and double quotes in the general.json
, insurances.json
, and color_palette.json
files. Incorrect format may prevent them from being loaded..env
file before running this in production (deployment). Once you run it for the first time, it will setup the database according to those settings. changing settings in the .env
file afterwards may require alterations to the database to get it working again.frontend/settings
files..env
fileDB_ROOT_USERNAME
and DB_USER
should not be the same and their passwords should be secure pass phrases and also not the same.ADMIN_USER
and password will be the only credentials used by users when accessing your.domain.com/classes/admin.HOST
should be your domain excluding the https:// part. For example: your.domain.comcolor_palette.json
fileThis file adjusts the colors of the class cards. You can add as many colors as you'd like in the format of hexidecimal colors. If you'd like to stick with the defaults, you can just copy paste the color_palette.sample.json
file into this one.
general.json
fileThe Fee Message
setting replaces all occurances of {FEE}
with the fee for that particular class. For example if the setting was Pay {FEE} dollars at the gate.
, then the message would be Pay 5.00 dollars at the gate. assuming the class has a fee of 5.00.
insurances.json
fileThis file is broken into 2 sections, the Insurances
section and the Sponsors
section.
Insurances
sectionThe options listed here will show up on the signup form in the insurance dropdown list. Selecting an insurance other than Other/None will cause a new field to appear. This field will by default say Insurance Member ID
. If you would like to change what that field says for a particular insurance option, change the option to this format:
{
"name": "Insurance Name",
"id_name": "Appeared Field Name"
}
name
should be the insurance name and id_name
should be the text you want to replace Insurance Member ID
with.
Sponsors
sectionThe options listed here will show up on the Sponsors dropdown in the admin menu when creating a new class. If a class is sponsored by the same insurance that the user signing up chooses as their insurance, they can take the class for free. Note that the insurance names in the Insurances
list and the Sponsors
list need to be exactly the same for this to be the case.
If you want a particular sponsor to make multiple insurances choices free for the user, use the following format:
{
"name": "Insurance Name",
"also_free_for": "Other Insurance Name"
},
name
should be the sponsor name and also_free_for
should be the name of the other insurance that will be free if chosen by the user. Note that this allows you to have more control in what shows up as the sponsor, for example you could make the name
be TakeCare and Triple J
and make also_free_for
be TakeCare
, allowing users of TakeCare to sign up for free.
also_free_for
can also be a list of other insurance names like so:
{
"name": "Paradise Fitness",
"also_free_for": [
"TakeCare",
"Calvo's SelectCare"
]
}
If a class is sponsored by this sponsor, users of any of these insurances get in free.
Finally, also_free_for
can also be the special value all
. A class doesn't need to be sponsored by this insurance for users to get into any class by choosing this insurance. This can be used in conjunction with the Insurances
list to for example make all Hotel Guest
"insurances" free. Here is an example configuration showing how to do so:
{
"Insurances": [
...
{
"name": "Hotel Guest",
"id_name": "Room Number"
}
],
"Sponsors": [
...
{
"name": "Hotel Guest",
"also_free_for": "all"
}
]
}
You can access the logs by using the command docker compose logs
(check out the docs for more detailed options)
If you suspect a problem with a certain portion of the app, you can use docker compose logs
followed by one of the short service names below:
frontend
backend
db
nginx
certbot
The Database is stored in the db/data
folder, so if you'd like to make backups, do so by copying that directory.
If you'd like to execute queries on the database, you can open a shell to it using the following command for production (deployment):
source .env && docker exec -it gym_classes_db mongosh -u $DB_USER -p $DB_PASSWORD production
or this command for development:
source .env && docker exec -it gym_classes_db mongosh -u $DB_USER -p $DB_PASSWORD development
The database used is MongoDB version 7.0.3. You can find docs for the mongosh
shell here.