Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p10ns11y/peramsathyam
poems and blogs
https://github.com/p10ns11y/peramsathyam
fly postcss reactjs remix-run stately tailwindcss xstate
Last synced: 7 days ago
JSON representation
poems and blogs
- Host: GitHub
- URL: https://github.com/p10ns11y/peramsathyam
- Owner: p10ns11y
- Created: 2022-10-01T21:13:03.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T06:18:40.000Z (about 2 years ago)
- Last Synced: 2023-02-26T10:01:35.138Z (over 1 year ago)
- Topics: fly, postcss, reactjs, remix-run, stately, tailwindcss, xstate
- Language: TypeScript
- Homepage: https://peramsathyam.fly.dev/
- Size: 2.15 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Peram Sathyam's site!
How to setup and deploy to fly.io
## Fly Setup
1. [Install Fly](https://fly.io/docs/getting-started/installing-flyctl/)
2. Sign up and log in to Fly
```sh
flyctl auth **signup**
```3. Setup Fly. It might ask if you want to deploy, say no since you haven't built the app yet.
```sh
flyctl launch
```## Development
From your terminal:
```sh
npm run dev
```This starts your app in development mode, rebuilding assets on file changes.
## Deployment
This Remix Stack comes with two GitHub Actions that handle automatically deploying your app to production and staging environments.
Prior to your first deployment, you'll need to do a few things:
- [Install Fly](https://fly.io/docs/getting-started/installing-flyctl/)
- Sign up and log in to Fly
```sh
fly auth signup
```> **Note:** If you have more than one Fly account, ensure that you are signed into the same account in the Fly CLI as you are in the browser. In your terminal, run `fly auth whoami` and ensure the email matches the Fly account signed into the browser.
- Create two apps on Fly, one for staging and one for production:
```sh
fly apps create app-name-740a
fly apps create app-name-740a-staging
```> **Note:** Make sure this name matches the `app` set in your `fly.toml` file. Otherwise, you will not be able to deploy.
- Initialize Git.
```sh
git init
```- Create a new [GitHub Repository](https://repo.new), and then add it as the remote for your project. **Do not push your app yet!**
```sh
git remote add origin
```- Add a `FLY_API_TOKEN` to your GitHub repo. To do this, go to your user settings on Fly and create a new [token](https://web.fly.io/user/personal_access_tokens/new), then add it to [your repo secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) with the name `FLY_API_TOKEN`.
- Add a `SESSION_SECRET` to your fly app secrets, to do this you can run the following commands:
```sh
fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app blog-tutorial-740a
fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app blog-tutorial-740a-staging
```If you don't have openssl installed, you can also use [1password](https://1password.com/password-generator/) to generate a random secret, just replace `$(openssl rand -hex 32)` with the generated secret.
- Create a persistent volume for the sqlite database for both your staging and production environments. Run the following:
```sh
fly volumes create data --size 1 --app app-name-740a
fly volumes create data --size 1 --app app-name-740a-staging
```Now that everything is set up you can commit and push your changes to your repo. Every commit to your `main` branch will trigger a deployment to your production environment, and every commit to your `dev` branch will trigger a deployment to your staging environment.
### Connecting to your database
The sqlite database lives at `/data/sqlite.db` in your deployed application. You can connect to the live database by running `fly ssh console -C database-cli`.
### Getting Help with Deployment
If you run into any issues deploying to Fly, make sure you've followed all of the steps above and if you have, then post as many details about your deployment (including your app name) to [the Fly support community](https://community.fly.io). They're normally pretty responsive over there and hopefully can help resolve any of your deployment issues and questions.
## GitHub Actions
We use GitHub Actions for continuous integration and deployment. Anything that gets into the `main` branch will be deployed to production after running tests/build/etc. Anything in the `dev` branch will be deployed to staging.
You can run `flyctl info` to get the url and ip address of your server.
Check out the [fly docs](https://fly.io/docs/getting-started/node/) for more information.