website
The website for https://crystal-china.org
Development dependencies
- Crystal
- pg
- node (with yarn)
Development
-
First, install Crystal. You can check out the instructions here: https://crystal-lang.org/install/
-
Next, run
shards install
to install shards dependencies. -
Run
script/setup
, Just make sure you’ve got PostgreSQL (pg) and nodejs/yarn installed before running this. -
Finally, run
lucky dev
, and you're all set!
deployment
There are no runtime dependencies when deploying to a remote Linux environment except one static binary with all assets baked into it, and will auto mount when running.
Following is the process for create the static binary:
-
Run
shards run index
to create a index for all markdowns docs intopublic/docs/index.st
, use bin/stork. -
Run
yarn prod
to package assets use laravel mix. -
To built a static binary use sb_static script. for more details instructions on building a static binary use zigcc, check use zig gcc as an an alternative linker
-
copy the built static binary(
bin/crystal_china
) into remote linux host asbin/crystal_china
, then set the necessary ENV in file.env
, check the .env.sample for a example. You will have the following directory structure.. ├── .env └── bin/crystal_china
If server was started, you have to stop it before copy the binary successful. a more robust way to do this is use a binary diff tools create patch locally, and then send patch file to remote server apply it, this way you can update the binary on the fly, then reboot systemd service is all done.
-
Add a systemd service to start the server, review the configuration for the crystal_china.service consider using procodile as an alternative for above .env and systemd services.
-
Optionally, use nginx as a reverse proxy. You can find configuration details in nginx folder
Contributing
- Fork it (https://github.com/zw963/website/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Billy.Zheng - creator and maintainer
website
- 0
- 0
- 0
- 0
- 14
- 9 days ago
- September 2, 2024
MIT License
Wed, 02 Apr 2025 03:28:57 GMT