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

Running locally with localstack #13

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AWS_BUCKET_NAME="shipthing"
AWS_REGION="us-east-1"
AWS_ENDPOINT="http://localhost:4566"
REDIS_ADDR="localhost:6379"
REDIS_PASSWORD="passwd"
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AWS_BUCKET_NAME="shipthing"
AWS_REGION="us-east-1"
AWS_ENDPOINT="http://localhost:4566"
REDIS_ADDR="localhost:6379"
REDIS_PASSWORD="passwd"
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
Expand All @@ -32,4 +32,7 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc
tmp
tmp

# Ignore localstack volume files
volume
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
## Shipthing
Create your cloud is not that hard.

Create your cloud is not that hard.

## Static deployments (Step 1)

![CleanShot 2024-03-01 at 12 28 31@2x](https://github.com/NicolasLopes7/shipthing/assets/57234795/285eaa3d-caa0-4137-a2c1-8f44060bc22f)

## Support containers (Step 2)

![image](https://github.com/NicolasLopes7/shipthing/assets/57234795/9d1f796c-e0fd-4fbf-abd6-788be88cee8b)

## Running in local environment

1. Use the `.env.example` as reference to create your configuration file `.env` with your own Credentials;

2. ```bash
cd shipthing
docker-compose up
awslocal s3api create-bucket --bucket shipthing
```
4 changes: 3 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ func InitConfig() error {

func createAwsSession() (*session.Session, error) {
sesh, err := session.NewSession(&aws.Config{
Region: aws.String(os.Getenv("AWS_REGION")),
Region: aws.String(os.Getenv("AWS_REGION")),
Endpoint: aws.String(os.Getenv("AWS_ENDPOINT")),
S3ForcePathStyle: aws.Bool(true),
})

if err != nil {
Expand Down
18 changes: 15 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
version: '3.8'
version: "3.8"
services:
redis:
image: redis:6.2-alpine
restart: always
ports:
- '6379:6379'
command: redis-server --loglevel warning --requirepass passwd
- "6379:6379"
command: redis-server --loglevel warning --requirepass passwd
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack:s3-latest
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
- DEBUG=${DEBUG:-0}
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.6.0
github.com/joho/godotenv v1.5.1
github.com/redis/go-redis/v9 v9.5.1
golang.org/x/sync v0.6.0
)

Expand All @@ -32,7 +33,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/redis/go-redis/v9 v9.5.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/aws/aws-sdk-go v1.50.28 h1:cXltYLw4dq10YPAwk8EGYJjeQlCky4tyxAllWmVQZ9Y=
github.com/aws/aws-sdk-go v1.50.28/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.11.2 h1:ywfwo0a/3j9HR8wsYGWsIWl2mvRsI950HyoxiBERw5A=
Expand Down