Skip to content

Commit

Permalink
fix actions
Browse files Browse the repository at this point in the history
  • Loading branch information
asavienko committed Oct 25, 2023
1 parent df71c1f commit 93bec92
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 45 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build-deploy-by-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
echo "FRONTEND_PORT=$FRONTEND_PORT" >> $GITHUB_OUTPUT
echo "BACKEND_PORT=$BACKEND_PORT" >> $GITHUB_OUTPUT
echo "HOST=$HOST" >> $GITHUB_OUTPUT
echo "IMAGE_PREFIX=ghcr.io/runtimeverification/kontrol" >> $GITHUB_OUTPUT
echo "IMAGE_PREFIX=ghcr.io/runtimeverification/simbolik" >> $GITHUB_OUTPUT
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
nginx_main_config="$(cat ${{ github.workspace }}/configs/nginx/nginx.conf)"
Expand Down Expand Up @@ -95,28 +95,28 @@ jobs:
script: |
source "/home/ubuntu/.acme.sh/acme.sh.env"
PULL_REQUEST_NAME=$(printf "pr-%s" ${{ github.event.number }})
mkdir -p /opt/deployments/kontrol-$PULL_REQUEST_NAME
cd /opt/deployments/kontrol-$PULL_REQUEST_NAME
mkdir -p /opt/deployments/simbolik-$PULL_REQUEST_NAME
cd /opt/deployments/simbolik-$PULL_REQUEST_NAME
# Frontend
docker pull ${{ needs.build.outputs.IMAGE_PREFIX }}/frontend:$PULL_REQUEST_NAME
docker stop kontrol-frontend-$PULL_REQUEST_NAME
docker rm kontrol-frontend-$PULL_REQUEST_NAME
docker stop simbolik-frontend-$PULL_REQUEST_NAME
docker rm simbolik-frontend-$PULL_REQUEST_NAME
docker run -p ${{ needs.build.outputs.FRONTEND_PORT }}:3000 \
--name kontrol-frontend-$PULL_REQUEST_NAME \
--name simbolik-frontend-$PULL_REQUEST_NAME \
-d --restart=always \
-e GRAPHQL_ENDPOINT=https://${{ needs.build.outputs.HOST }}/graphql \
-e RECAPTCHA_SITE_KEY=${{ secrets.RECAPTCHA_SITE_KEY }} \
${{ needs.build.outputs.IMAGE_PREFIX }}/frontend:$PULL_REQUEST_NAME
# Backend
docker pull ${{ needs.build.outputs.IMAGE_PREFIX }}/backend:$PULL_REQUEST_NAME
docker stop kontrol-backend-$PULL_REQUEST_NAME
docker rm kontrol-backend-$PULL_REQUEST_NAME
docker stop simbolik-backend-$PULL_REQUEST_NAME
docker rm simbolik-backend-$PULL_REQUEST_NAME
docker run -p ${{ needs.build.outputs.BACKEND_PORT }}:8080 \
--name kontrol-backend-$PULL_REQUEST_NAME \
--name simbolik-backend-$PULL_REQUEST_NAME \
-d --restart=always \
-e DATABASE_URL="postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/kontrol?schema=$PULL_REQUEST_NAME&connection_limit=40&pool_timeout=30" \
-e DATABASE_URL="postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/simbolik?schema=$PULL_REQUEST_NAME&connection_limit=40&pool_timeout=30" \
-e FRONTEND_URL=https://${{ needs.build.outputs.HOST }} \
-e GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} \
-e GITHUB_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} \
Expand Down Expand Up @@ -224,13 +224,13 @@ jobs:
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: kontrol/backend
name: simbolik/backend
token: ${{ secrets.GITHUB_TOKEN }}
untagged-keep-latest: 1
- name: Clean frontend untagged images
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: kontrol/frontend
name: simbolik/frontend
token: ${{ secrets.GITHUB_TOKEN }}
untagged-keep-latest: 1
24 changes: 12 additions & 12 deletions .github/workflows/build-deploy-by-push-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- id: process-outputs
name: Process Outputs
run: |
echo "IMAGE_PREFIX=ghcr.io/runtimeverification/kontrol" >> $GITHUB_OUTPUT
echo "IMAGE_PREFIX=ghcr.io/runtimeverification/simbolik" >> $GITHUB_OUTPUT
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
nginx_main_config="$(cat ${{ github.workspace }}/configs/nginx/nginx.conf)"
Expand Down Expand Up @@ -81,16 +81,16 @@ jobs:
port: 22
script: |
source "/home/ubuntu/.acme.sh/acme.sh.env"
mkdir -p /opt/deployments/kontrol-${{ github.ref_name }}
cd /opt/deployments/kontrol-${{ github.ref_name }}
mkdir -p /opt/deployments/simbolik-${{ github.ref_name }}
cd /opt/deployments/simbolik-${{ github.ref_name }}
# Frontend
docker tag ${{ needs.build.outputs.IMAGE_PREFIX }}/frontend:${{ github.ref_name }} ${{ needs.build.outputs.IMAGE_PREFIX }}/frontend:${{ github.ref_name }}-backup
docker pull ${{ needs.build.outputs.IMAGE_PREFIX }}/frontend:${{ github.ref_name }}
docker stop kontrol-frontend-${{ github.ref_name }} || true
docker rm kontrol-frontend-${{ github.ref_name }} || true
docker stop simbolik-frontend-${{ github.ref_name }} || true
docker rm simbolik-frontend-${{ github.ref_name }} || true
docker run -p ${{ needs.build.outputs.FRONTEND_PORT }}:3000 \
--name kontrol-frontend-${{ github.ref_name }} \
--name simbolik-frontend-${{ github.ref_name }} \
-d --restart=always \
-e GRAPHQL_ENDPOINT=https://${{ needs.build.outputs.HOST }}/graphql \
-e RECAPTCHA_SITE_KEY=${{ secrets.RECAPTCHA_SITE_KEY }} \
Expand All @@ -99,12 +99,12 @@ jobs:
# Backend
docker tag ${{ needs.build.outputs.IMAGE_PREFIX }}/backend:${{ github.ref_name }} ${{ needs.build.outputs.IMAGE_PREFIX }}/backend:${{ github.ref_name }}-backup
docker pull ${{ needs.build.outputs.IMAGE_PREFIX }}/backend:${{ github.ref_name }}
docker stop kontrol-backend-${{ github.ref_name }} || true
docker rm kontrol-backend-${{ github.ref_name }} || true
docker stop simbolik-backend-${{ github.ref_name }} || true
docker rm simbolik-backend-${{ github.ref_name }} || true
docker run -p ${{ needs.build.outputs.BACKEND_PORT }}:8080 \
--name kontrol-backend-${{ github.ref_name }} \
--name simbolik-backend-${{ github.ref_name }} \
-d --restart=always \
-e DATABASE_URL="postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/kontrol?schema=${{ github.ref_name }}&connection_limit=40&pool_timeout=30" \
-e DATABASE_URL="postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/simbolik?schema=${{ github.ref_name }}&connection_limit=40&pool_timeout=30" \
-e FRONTEND_URL=https://${{ needs.build.outputs.HOST }} \
-e GITHUB_CALLBACK_HOST=${{ needs.build.outputs.HOST }} \
-e GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} \
Expand Down Expand Up @@ -212,13 +212,13 @@ jobs:
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: kontrol/backend
name: simbolik/backend
token: ${{ secrets.GITHUB_TOKEN }}
untagged-keep-latest: 1
- name: Clean frontend untagged images
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: kontrol/frontend
name: simbolik/frontend
token: ${{ secrets.GITHUB_TOKEN }}
untagged-keep-latest: 1
16 changes: 8 additions & 8 deletions .github/workflows/close-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
FRONTEND_PORT=$(printf "%d" $(expr 9000 + $PULL_REQUEST_NUMBER))
BACKEND_PORT=$(printf "%d" $(expr 10000 + $PULL_REQUEST_NUMBER))
HOST=$(printf "pr-%s.%s" ${{ github.event.number }} ${{ vars.HOST }})
echo "IMAGE_PREFIX=ghcr.io/runtimeverification/kontrol" >> $GITHUB_OUTPUT
echo "IMAGE_PREFIX=ghcr.io/runtimeverification/simbolik" >> $GITHUB_OUTPUT
echo "FRONTEND_PORT=$FRONTEND_PORT" >> $GITHUB_OUTPUT
echo "BACKEND_PORT=$BACKEND_PORT" >> $GITHUB_OUTPUT
echo "HOST=$HOST" >> $GITHUB_OUTPUT
Expand All @@ -38,11 +38,11 @@ jobs:
script: |
source "/home/ubuntu/.acme.sh/acme.sh.env"
PULL_REQUEST_NAME=$(printf "pr-%s" ${{ github.event.number }})
docker stop kontrol-frontend-$PULL_REQUEST_NAME
docker rm kontrol-frontend-$PULL_REQUEST_NAME
docker stop kontrol-backend-$PULL_REQUEST_NAME
docker rm kontrol-backend-$PULL_REQUEST_NAME
rm -rfv /opt/deployments/kontrol-${PULL_REQUEST_NAME}
docker stop simbolik-frontend-$PULL_REQUEST_NAME
docker rm simbolik-frontend-$PULL_REQUEST_NAME
docker stop simbolik-backend-$PULL_REQUEST_NAME
docker rm simbolik-backend-$PULL_REQUEST_NAME
rm -rfv /opt/deployments/simbolik-${PULL_REQUEST_NAME}
cd /opt/deployments/nginx
rm -rfv ./conf.d/${{ steps.process-outputs.outputs.HOST }}.conf
rm -rfv ./ssl/${{ steps.process-outputs.outputs.HOST }}
Expand All @@ -60,13 +60,13 @@ jobs:
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: kontrol/backend
name: simbolik/backend
token: ${{ secrets.GITHUB_TOKEN }}
tag: pr-${{github.event.number}}
- name: Clean PR frontend image
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: kontrol/frontend
name: simbolik/frontend
token: ${{ secrets.GITHUB_TOKEN }}
tag: pr-${{github.event.number}}
2 changes: 1 addition & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ lerna-debug.log*
!.vscode/launch.json
!.vscode/extensions.json

# ERCX
# simbolik
.env
database.sqlite
database.sqlite-journal
Expand Down
2 changes: 1 addition & 1 deletion backend/generate-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -e
# We use either $CHANGE_BRANCH of $BRANCH_NAME
branch_name=${CHANGE_BRANCH:-$BRANCH_NAME}

echo "DATABASE_URL=\"postgresql://$ERCX_POSTGRES_USERNAME:$ERCX_POSTGRES_PASSWD@$ERCX_POSTGRES_HOST_AND_PORT/$ERCX_POSTGRES_DB?schema="$BRANCH_NAME"&connection_limit=40&pool_timeout=30\"" >>.env
echo "DATABASE_URL=\"postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST_AND_PORT/$POSTGRES_DB?schema="$BRANCH_NAME"&connection_limit=40&pool_timeout=30\"" >>.env
6 changes: 3 additions & 3 deletions backend/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ POSTGRES_USER=some_user
POSTGRES_PASSWORD=some_password

# Postgres connection string.
# "ercx" is the name of the database. See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING.
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/db?schema=${BRANCH_NAME}&connection_limit=40&pool_timeout=30
# "simbolik" is the name of the database. See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING.
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/simbolik?schema=${BRANCH_NAME}&connection_limit=40&pool_timeout=30


# Password to encrypt the JWT tokens
Expand All @@ -41,7 +41,7 @@ GOOGLE_CLIENT_SECRET=xxxx # The client secret of the Google OAuth app.
# The key below is for local development:
RECAPTCHA_SECRET_KEY=6Ld9pOUjAAAAAGIDO3K3KSrYomGt4ty0SXRpCHTz

GITHUB_WORKFLOW_TRIGGER_TOKEN=xxxx # The rv-auditor GitHub token. Used to dispatch the GitHub workflow in runtimeverification/ercx-website repository.
GITHUB_WORKFLOW_TRIGGER_TOKEN=xxxx # The rv-auditor GitHub token. Used to dispatch the GitHub workflow in runtimeverification/simbolik repository.

# SMTP server configuration.
EMAIL_HOST=smtp.google.com
Expand Down
2 changes: 1 addition & 1 deletion backend/src/github/github.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class GithubService {
async importAdmins(): Promise<User[]> {
const response = await this.octokit.rest.teams.listMembersInOrg({
org: 'runtimeverification',
team_slug: 'ercx',
team_slug: 'web',
});

const users = await this.prismaService.$transaction(
Expand Down
2 changes: 1 addition & 1 deletion backend/src/graphql/graphql.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class GqlOptionsService implements GqlOptionsFactory {
return {
driver: ApolloDriver,
debug: process.env.NODE_ENV !== 'production',
playground: { title: 'ERCx GraphQL Playground' },
playground: { title: 'simbolik GraphQL Playground' },
subscriptions: {
'graphql-ws': this.subscriptionConfig,
'subscriptions-transport-ws': this.subscriptionConfig,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ async function bootstrap() {
const configService: ConfigService = app.get<ConfigService>(ConfigService);

const swaggerConfig = new DocumentBuilder()
.setTitle('ERCX Website')
.setDescription('The ERCX Website API description')
.setTitle('Simbolik Website')
.setDescription('The Simbolik Website API description')
.setVersion('0.1.0')
.addBearerAuth()
.build();
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function Account() {
return (
<>
<Head>
<title>{'Account | Kontrol Website'}</title>
<title>{'Account | Simbolik Website'}</title>
</Head>
<Container>
<div className="container">
Expand Down
2 changes: 1 addition & 1 deletion frontend/next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
siteUrl:
process.env.NEXT_PUBLIC_SITE_URL || 'https://ercx.runtimeverification.com',
process.env.NEXT_PUBLIC_SITE_URL || 'https://simbolik.runtimeverification.com',
generateRobotsTxt: true,
exclude: ['/account', '/access-token']
};
4 changes: 2 additions & 2 deletions frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';
import AppWrapper from '@/containers/AppWrapper';
import getConfig from 'next/config';

export default function KontrolApp({ Component, pageProps }: AppProps) {
export default function SimbolikApp({ Component, pageProps }: AppProps) {
const {
publicRuntimeConfig: { reCaptchaKey }
} = getConfig();
Expand All @@ -21,7 +21,7 @@ export default function KontrolApp({ Component, pageProps }: AppProps) {
);
}

KontrolApp.getInitialProps = async (
SimbolikApp.getInitialProps = async (
context: AppContext
): Promise<AppInitialProps> => {
const ctx = await App.getInitialProps(context);
Expand Down

0 comments on commit 93bec92

Please sign in to comment.