Skip to content

Commit

Permalink
Add staging CI #589
Browse files Browse the repository at this point in the history
Try on push

Try develop


#192 https setup docs


try again

add environments

fix yml

Try nested job

try again

Require secrets

remote_host

fix inputs

Add remote host for production
  • Loading branch information
joepio committed Feb 9, 2023
1 parent 5aa187f commit 563d28e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 11 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/deploy_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Deployment Staging

on:
workflow_dispatch:
push:
branches:
- 'master'
jobs:
deploy-staging:
uses: './.github/workflows/deployment.yml'
with:
environment: production
remote_host: atomicdata.dev
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/deploy_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Deployment Staging

on:
workflow_dispatch:
push:
branches:
- 'develop'
jobs:
deploy-staging:
uses: './.github/workflows/deployment.yml'
with:
environment: staging
remote_host: staging.atomicdata.dev
secrets: inherit
21 changes: 17 additions & 4 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
name: Deployment
name: Deployment (re-use)

on:
workflow_dispatch:
workflow_call:
inputs:
environment:
required: true
type: string
remote_host:
required: true
type: string
secrets:
REMOTE_USER:
required: true
SSH_PRIVATE_KEY:
required: true

jobs:
deploy:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -25,13 +38,13 @@ jobs:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "target/x86_64-unknown-linux-musl/release/atomic-server"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_HOST: ${{ inputs.remote_host }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ~/
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
host: ${{ inputs.remote_host }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
Expand Down
15 changes: 9 additions & 6 deletions server/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
# domain name where the server is hosted, including subdoman, without schema (http) and port
# ATOMIC_DOMAIN=localhost

# Port where it's running. Make sure you have the rights to run at this port.
# Both an HTTPS and an HTTP port can be specified.

# Set this to 80 if you're running this publicly
# ATOMIC_PORT=9883

# Set this to 443 if you're running this publicly
# ATOMIC_PORT_HTTPS=9884

# Whether you want to enable HTTPS. If set to true, the server will initialize Certification process on start using Let'sEncrypt. You'll need to set ATOMIC_EMAIL for this.
# ATOMIC_HTTPS=false

Expand All @@ -24,12 +33,6 @@
# Path to where your config will be stored.
# ATOMIC_CONFIG_FILE_PATH="/Users/your_home_folder/.config/atomic/config.toml"

# Port where it's running. Make sure you have the rights to run at this port.
# Both an HTTPS and an HTTP port can be specified.
# Both are necesssary during CERT_INIT
# ATOMIC_PORT=9883
# ATOMIC_PORT_HTTPS=9884

# Local IP where it's running. Use :: if you want it to be public.
# ATOMIC_IP=::

Expand Down
2 changes: 1 addition & 1 deletion server/src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub async fn cert_init_server(config: &crate::config::Config) -> AtomicServerRes
request_cert(config)
.await
.map_err(|e| format!("Certification init failed: {}", e))?;
tracing::warn!("HTTPS TLS Cert init sucesful! Stopping HTTP server, starting HTTPS...");
tracing::warn!("HTTPS TLS Cert init successful! Stopping HTTP server, starting HTTPS...");
handle.stop(true).await;
Ok(())
}
Expand Down

0 comments on commit 563d28e

Please sign in to comment.