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

hi #36

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

hi #36

Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fly.toml
Dockerfile
.dockerignore
node_modules
.git
49 changes: 49 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deployment pipeline

on:
push:
branches:
- master
pull_request:
branches: [master]
types: [opened, synchronize]

jobs:
deployment_prep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: npm install
run: npm install
- name: lint
run: npm run lint
- name: build
run: npm run build
deploy:
name: Deploy app
needs: [deployment_prep]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ''), '#skip') }}
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
tag_release:
needs: [deploy]
permissions: write-all
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ''), '#skip') }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/github-tag-action@eca2b69f9e2c24be7decccd0f15fdb1ea5906598
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: 'patch'
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM debian:bullseye as builder

ARG NODE_VERSION=16.16.0

RUN apt-get update; apt install -y curl python-is-python3 pkg-config build-essential
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION}

#######################################################################

RUN mkdir /app
WORKDIR /app

# NPM will not install any package listed in "devDependencies" when NODE_ENV is set to "production",
# to install all modules: "npm install --production=false".
# Ref: https://docs.npmjs.com/cli/v9/commands/npm-install#description

ENV NODE_ENV production

COPY . .

RUN npm install && npm run build
FROM debian:bullseye

LABEL fly_launch_runtime="nodejs"

COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app

WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH

CMD [ "npm", "run", "start" ]
12 changes: 12 additions & 0 deletions client/components/App 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import NavBar from 'Components/NavBar'
import Footer from 'Components/Footer'
import Router from 'Components/Router'

export default () => (
<>
<NavBar />
<Router />
<Footer />
</>
)
10 changes: 10 additions & 0 deletions client/components/Footer 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { images } from 'Utilities/common'

const Footer = () => (
<div className="footer">
<img src={images.toskaLogo} alt="toska" />
</div>
)

export default Footer
10 changes: 10 additions & 0 deletions client/components/FrontPage/index 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'

const FrontPage = () => (
<>
Welcome
<a href="/messages">Messages</a>
</>
)

export default FrontPage
1 change: 0 additions & 1 deletion client/components/MessageView/MessageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ const MessageList = ({ messages, deleteMessage }) => {
)
}


export default MessageList
10 changes: 10 additions & 0 deletions client/components/NavBar 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { images } from 'Utilities/common'

const NavBar = () => (
<div className="navbar">
<img src={images.toskaLogo} alt="toska" />
</div>
)

export default NavBar
11 changes: 11 additions & 0 deletions client/util/common 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Insert common items for frontend here
*/
import toskaLogo from 'Assets/toskalogo_color.svg'

export const images = {
toskaLogo,
}

// Everything from application wide common items is available through here
export * from '@root/config/common'
9 changes: 9 additions & 0 deletions config/common 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Insert application wide common items here, they're all exported by frontend and backend common.js respectively
*/

const inProduction = process.env.NODE_ENV === 'production'

module.exports = {
inProduction,
}
38 changes: 38 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# fly.toml file generated for twilight-river-2470 on 2023-03-02T19:18:54-05:00

app = "twilight-river-2470"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
PORT = "8080"

[experimental]
auto_rollback = true

[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
Loading