Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
echo "CREATE DATABASE sampledb" | PGPASSWORD=password psql -h localhost -U user
# or
cat your.sql | PGPASSWORD=password psql -h localhost -U user
version: '3.1'
services:
postgres:
image: 'postgres:13.2'
container_name: postgres
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
package com.example.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
package com.example.config;
import com.example.service.impl.AppUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.password.PasswordEncoder;
deploy-to-aws:
...略
- steps:
...略
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Use Node.js
deploy-to-aws:
...略
- steps:
...略
- name: Deploy crawler with terraform
run: |-
cd section_18/crawler/env
terraform init
terraform plan -out dev.tfplan
terraform apply dev.tfplan || touch build_failed.txt
deploy-to-aws:
needs: test-crawler-before-deploy-to-aws
name: deploy-to-aws
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set PEM & SQL
run: |-
echo "$PEM" > section_18/crawler/proxy.pem
test-crawler-before-deploy-to-aws:
name: test-crawler-before-deploy-to-aws
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set PEM
run: |-
echo "$PEM" > section_18/crawler/proxy.pem
env:
terraform {
backend "remote" {
organization = "YOUR_ORG"
workspaces {
name = "YOUR_WORKSPACE"
}
}
}
name: Section 17 crawler test
on:
workflow_dispatch:
jobs:
test-crawler:
name: test-crawler
runs-on: ubuntu-latest
steps: